Created
March 13, 2024 04:58
-
-
Save Vicfred/0f08ba1e87e6926d3ea9c902b9ab37d9 to your computer and use it in GitHub Desktop.
portrait resize to 4:5 add bars
This file contains 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
#!/bin/bash | |
for image_file in *.jpg; do | |
width=$(identify -format '%w' "$image_file") | |
height=$(identify -format '%h' "$image_file") | |
width_difference=$((height * 4/5 - width)) | |
bar_size=$((width_difference/2)) | |
echo "adding bar of size" $bar_size | |
convert $image_file -bordercolor black -border $((bar_size))x0 -quality 100 $image_file | |
echo "resizing from" $width "x" $height "to 1080x1350" | |
convert $image_file -resize 1080x1350 -quality 95 $image_file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment