A tool that pads images or videos to any aspect ratio while preserving the original resolution. Add space around your images/videos with custom padding or convert to specific aspect ratios like 16:9, 4:3, 1:1 square, and more. Perfect for social media posts or vlogs, video thumbnails, and printing.
- Preserve original image/video resolution and quality
- Choose any background color, with optional transparency
- Pad images with specific aspect ratios or custom padding
- Process multiple images at once (website only, for now)
- Pad videos (command-line version only)
- Works with all common image formats (JPG, PNG, HEIC etc.)
- Works with all common video formats (mp4, mov, etc.)
https://amitjoshi2724.github.io/ImagePadder/
The web version is the easiest way to use Image Padder, with a user-friendly interface and additional options like custom padding. The website does NOT support video padding, for that keep reading.
Note: Browser-based tools have resolution limits (typically 16,384 × 16,384 pixels). For very high-resolution images, HEIC/HEIF images, or video padding, use the command-line version or Python Graphical-User-Interface (GUI) below.
Image Padder is built as a full Progressive Web App (PWA) powered by a dedicated Service Worker (sw.js) and Web App Manifest (manifest.json).
Once installed to your desktop or smartphone:
✈️ 100% Offline Capable: The entire client-side image processing engine, canvas pipeline, and UI are pre-cached directly to persistent device storage via the Cache Storage API. You can pad photos in Airplane Mode with zero Wi-Fi or cellular data anytime, anywhere.- 🖥️ Native Standalone Window: Launches in its own dedicated window without browser address bars, URL fields, or tabs.
- 🔄 Zero-Hassle Background Updates: When you connect to Wi-Fi, the Service Worker automatically fetches and updates any new changes pushed to GitHub.
You can install Image Padder directly as a native macOS desktop application with its own dedicated window, Dock icon, and full offline support:
- Open https://amitjoshi2724.github.io/ImagePadder/ in Safari.
- In the top menu bar, click File > Add to Dock... (or click the Share button in the Safari toolbar and select Add to Dock).
- Name it Image Padder and click Add.
- The app is saved to your
Applicationsfolder and pinned to your macOS Dock. - Launch it like any native Mac app—it runs in its own window without browser tabs or address bars, and is 100% functional offline!
- Open https://amitjoshi2724.github.io/ImagePadder/ in Chrome, Brave, or Edge.
- Click the Install Image Padder icon in the right side of the address/URL bar (or go to Settings (⋮) > Save and share > Install Image Padder...).
- Click Install.
- The app opens in its own standalone desktop window and is added to your Mac's Launchpad, Spotlight, and
~/Applications/Chrome Appsfolder.
- Open https://amitjoshi2724.github.io/ImagePadder/ in Safari.
- Tap the Share button at the bottom of the screen (the square with an arrow pointing upward).
- Scroll down the share sheet and tap "Add to Home Screen".
- Tap Add in the top-right corner. A dedicated Image Padder icon will appear on your home screen.
- Tap the new icon once while online to let the Service Worker cache all assets—after that, it is permanently usable offline!
- Open https://amitjoshi2724.github.io/ImagePadder/ in Google Chrome.
- Tap the three-dots menu (⋮) in the top-right corner.
- Tap "Install app" (or "Add to Home screen").
- Tap Install on the prompt. The app will install directly to your home screen and app drawer as an offline-ready utility app.
Python 3.4+ is required to run this.
No virtual environment is required for running this. However, if this makes you feel more comfortable, you can set one up by using the following code:
python3 -m venv .venvsource .venv/bin/activate
Install required dependencies using the requirements.txt file:
pip install -r requirements.txt
This will install:
- PIL (Pillow): Core image processing library
- pillow-heif: For HEIC/HEIF support (Apple's image format)
- moviepy: For video padding support
- tkinter: For GUI (included with standard Python)
Or install Python dependencies manually:
pip install Pillow
pip install moviepy
pip install pillow-heif
For video padding functionality, FFmpeg needs to be installed on your system:
- macOS:
brew install ffmpeg - Ubuntu/Linux:
sudo apt-get install ffmpeg - Windows: Download from ffmpeg.org or use
choco install ffmpegwith Chocolatey
Note: The command-line tool will automatically detect if you're missing any required dependencies.
Fortunately, I have just made a new GUI if you prefer
- Run:
python imagepaddergui.py - Select an image or video using the "Browse" button
- Choose between "Aspect Ratio" or "Custom Padding" modes
- Configure your padding settings
- Select a background color (with optional transparency)
- Click "Process" to create your padded image/video
The image padder can be ran either by passing in command-line arguments to imagepadder2.py or by using the interactive prompt also within imagepadder2.py.
For image aspect ratio padding:
python3 imagepadder2.py '/Users/apple/Pictures/best_friends_photo.jpg' aspect 16x9 #FFFFFF 255
| Parameter | Description |
|---|---|
| 1: Image/Video path | Path to the image/video file |
| 2: Mode | aspect for aspect ratio mode |
| 3: Ratio | Width and height in format WxH (e.g., 16x9) |
| 4: Color | Background color in hex format (e.g., #FFFFFF for white) |
| 5: Opacity | Background opacity, 0-255 (e.g., 255 for fully opaque) |
For image custom padding:
python3 imagepadder2.py '/Users/apple/Pictures/best_friends_photo.jpg' custom 20 30 20 30 #000000 128
| Parameter | Description |
|---|---|
| 1: Image path | Path to the image file |
| 2: Mode | custom for custom padding mode |
| 3-6: Padding | Four values for padding in pixels: top right bottom left |
| 7: Color | Background color in hex format (e.g., #000000 for black) |
| 8: Opacity | Background opacity, 0-255 (e.g., 128 for half-transparent) |
For video aspect ratio padding:
python3 imagepadder2.py '/Users/apple/Videos/vacation.mp4' aspect 16x9 #000000 255
For video custom padding:
python3 imagepadder2.py '/Users/apple/Videos/vacation.mp4' custom 50 50 50 50 #0000FF 255
python3 imagepadder2.py
Then follow the prompts:
> image's filename to pad: /Users/apple/Pictures/best_friends_photo.jpg
> Choose padding mode ('aspect' for aspect ratio or 'custom' for custom padding): aspect
> Enter aspect ratio you desire in the form of WIDTHxHEIGHT, e.g. "4x3": 16x9
> Background color (hex format, e.g. #FFFFFF for white) [default: #FFFFFF]:
> Background opacity (0-255, default: 255): 255
OR
> image's filename to pad: /Users/apple/Videos/vacation.mp4
> Choose padding mode ('aspect' for aspect ratio or 'custom' for custom padding): aspect
> Enter aspect ratio you desire in the form of WIDTHxHEIGHT, e.g. "4x3": 16x9
> Background color (hex format, e.g. #FFFFFF for white) [default: #FFFFFF]: #000000
> Background opacity (0-255, default: 255): 255
OR
> image's filename to pad: /Users/apple/Pictures/best_friends_photo.jpg
> Choose padding mode ('aspect' for aspect ratio or 'custom' for custom padding): custom
> Enter top padding (pixels): 20
> Enter right padding (pixels): 30
> Enter bottom padding (pixels): 20
> Enter left padding (pixels): 30
> Background color (hex format, e.g. #FFFFFF for white) [default: #FFFFFF]: #000000
> Background opacity (0-255, default: 255): 128
| Command | Description |
|---|---|
python -m imagepadder2 image.jpg |
Interactive command-line mode |
python imagepaddergui.py |
Launch the graphical user interface |
python -m imagepadder2 image.jpg aspect 16x9 |
Pad to 16:9 aspect ratio |
python -m imagepadder2 image.jpg custom 10 20 30 40 |
Custom padding (top, right, bottom, left) |
python -m imagepadder2 image.jpg aspect 1x1 #FF0000 128 |
Square with semi-transparent (128 out of 255) red (#FF0000) background |
While most image processing tools in browsers have canvas size limitations (typically around 16,384 × 16,384 pixels), the command-line version of Image Padder can handle much larger images by using Python's PIL/Pillow library directly. For gigapixel images, or other extremely large files, the command-line version or GUI are needed, otherwise the website works fine.
The command-line version and python GUI support padding videos to different aspect ratios or adding custom padding. Supported formats include MP4, AVI, MOV, MKV, WEBM, and WMV. The padding is applied to each frame while preserving the original audio track. Due to the processing required, video padding may take some time depending on the length and resolution of the video, but progress is shown in command line, and somewhat in the logs section of the GUI.
The parameters work the same way as for images, but the tool will automatically detect if the file is a video based on the extension (mp4, avi, mov, mkv, webm, wmv). Note that the script is still called "imagepadder2.py" even for videos.
You can use the interactive prompt, CLI arguments, or GUI with both images and videos - the tool will automatically detect the file type and pad accordingly:
The program and the image padding algorithm were originally written by Amit Joshi (@amitjoshi2724). Code improvements were made by Jeffrey Wang (@jeffw16).
If you find this tool useful, consider supporting its development through one of these options:
Thank you for your support!
