Skip to content

Instantly share code, notes, and snippets.

@sgergely
Last active August 28, 2023 09:28
Show Gist options
  • Save sgergely/6cf3465348c75f7d6b3da2c7ffd3f086 to your computer and use it in GitHub Desktop.
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
#!/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