Last active
August 28, 2023 09:28
-
-
Save sgergely/6cf3465348c75f7d6b3da2c7ffd3f086 to your computer and use it in GitHub Desktop.
Crop the bottom of the image by maintaining the 16:9 aspect ratio
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 | |
# Set the desired width | |
width=2880 | |
# Calculate the corresponding height for 16:9 aspect ratio | |
height=$((width * 9 / 16 )) | |
# Loop through all JPEG files in the current directory | |
for file in *.png; do | |
output_file="cropped_$file" | |
sips --cropOffset 1 1 --cropToHeightWidth $height $width "$file" --out "$output_file" | |
echo "Resized $file to $output_file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment