Instagram is being a pain in the neck by limiting support to specific aspect ratios. Currently, you can only upload photos of no less than a 4/5 ratio for portrait mode and the peculiar 16/8.377 ratio for landscape shots, which is just a smidgen over the standard 16/9. Neither ratio is common in photography.

Let’s face it: Instagram is not the right platform for showcasing your photographic skills. But it is popular, and so we have to consider it. Many online services allow you to schedule Instagram posts. Such services work great as long as your photos fall within the supported dimensions.

When they don’t, you will need to crop them manually. But what’s the point of automation if you have to do things by hand? And so, I wrote a small shell script (you can download it here) that will go through a folder full of photos you want to upload to IG. The script will identify the images that fall outside the dimensions supported by Instagram. Any such images will be resized and padded to conform to IG’s limitations without you having to crop any of the original images.

Here’s an example of how this process works. The source folder contains your original photos. The script will resize them to no more than 2048px on the longest side if the originals are larger than that. The script will also add padding and a narrow border to images outside the supported aspect ratio range.

The original photo is less than the supported 4/5 ratio, and you would need to crop it to post on Instagram. The modified photo has a padding of complementary color and a narrow border. This image can be posted to Instagram without cropping.
A folder containing several photos. Some of these photos are supported by Instagram, but others would need to be cropped. These are the same photos after being processed by the script. The incompatible images have been modified to comply with IG’s aspect ratio limits.