A while ago, I created an Instagram account, but it kept cropping and
resizing my photos and so I haven't been uploading photos there
regularly. Instagram likes the 1:1 aspect ratio, 1080 x 1080 pixels. Other aspect ratios are also supported but this is the main one. For the supported ratios, see this help article.
Being sick of my photos being weirdly cropped on Instagram, I wrote a simple bash script to resize photos.
instaresize.sh
--------------
#!/bin/bash
for i in "$@"
do
if [ -z "$i" ]
then echo No photo file designated
else
filename=$i
basefilename="${filename%.*}"
convert "$filename" -resize 1080x1080 -gravity center -background "rgb(0,0,0)" -extent 1080x1080 "$basefilename"_instasize.jpg
fi
done
for i in "$@"
do
if [ -z "$i" ]
then echo No photo file designated
else
filename=$i
basefilename="${filename%.*}"
convert "$filename" -resize 1080x1080 -gravity center -background "rgb(0,0,0)" -extent 1080x1080 "$basefilename"_instasize.jpg
fi
done
--------------
Basically just use
instaresize.sh "my file to resize.png"
and it will output a 1080x1080 file, padded with black, to a file named
my file to resize_instasize.jpg
For example, this input photo
will be converted to this
Hope this helps.
My instagram account: maplerain78
(mainly for my calligraphy stuff)
Update: I have added this script to my repo of snippets.
Update: The script can now handle wildcards.
No comments:
Post a Comment