Bagheera Bghira
scripts
712958f
raw
history blame
562 Bytes
#!/bin/bash
resize_image() {
img="$1"
# Get image dimensions
dimensions=$(identify -format "%wx%h" "$img")
width=$(echo $dimensions | cut -dx -f1)
height=$(echo $dimensions | cut -dx -f2)
# Calculate new dimensions
if (( width < height )); then
new_dim="1024x"
else
new_dim="x1024"
fi
# Resize image with new dimensions
convert "$img" -resize "$new_dim" -filter Lanczos -antialias "${img%.*}_resized.png"
}
export -f resize_image
find /path/to/source/ | parallel -j$(nproc) resize_image {}