Last active
October 13, 2018 16:02
-
-
Save shinmiy/d125c80a48126792a044a864c383e38b to your computer and use it in GitHub Desktop.
Quick hack that adds a transparent border to convert images to 5:4 or 4:5 in order to post full size images to Instagram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick hack that adds a white border to convert images to 5:4 or 4:5 in order to post full size images to Instagram | |
# インスタにフルサイズの画像を投稿するために5:4もしくは4:5に画像を変換する(白い枠をつける) | |
filename="filename.jpg" | |
# Vertical Images / 縦画像 | |
convert $filename -virtual-pixel white -set option:distort:viewport "%[fx:h/5*4]x%[fx:h]-%[fx:(h/5*4-w)/2]-0" -filter point -distort SRT 0 +repage convert $1 -virtual-pixel white -set option:distort:viewport "%[fx:h/5*4]x%[fx:h]-%[fx:(h/5*4-w)/2]-0" -filter point -distort SRT 0 +repage "${filename%.*}_resized.${filename##*.}" | |
# Horizontal Images / 横画像 | |
convert $filename -virtual-pixel white -set option:distort:viewport "%[fx:w]x%[fx:w/5*4]-0-%[fx:(w/5*4-h)/2]" -filter point -distort SRT 0 +repage convert $1 -virtual-pixel white -set option:distort:viewport "%[fx:h/5*4]x%[fx:h]-%[fx:(h/5*4-w)/2]-0" -filter point -distort SRT 0 +repage "${filename%.*}_resized.${filename##*.}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment