Skip to content

Instantly share code, notes, and snippets.

@blackknight36
Created September 24, 2024 16:16
Show Gist options
  • Save blackknight36/fea4e202b0a898fbe6cca85721529e76 to your computer and use it in GitHub Desktop.
Save blackknight36/fea4e202b0a898fbe6cca85721529e76 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Process each PNG image
for image in *.png; do
# Define the output file path for the processed image with bleed
output_file="bleed/${image%.*}_with_bleed.${image##*.}"
# Skip processing if the output file already exists
if [ -f "$output_file" ]; then
echo "Skipping $image - already processed"
continue
fi
echo "Processing $image"
# Step 1: Resize the image to 744 x 1038 pixels (cut area)
magick "$image" -resize 744x1038 -gravity center -extent 744x1038 "resized/resized_${image%.*}.${image##*.}"
# Step 2: Add a 36-pixel bleed on each side, resulting in 822 x 1122 pixels (full bleed)
magick "resized/resized_${image%.*}.${image##*.}" -background white -gravity center -extent 822x1122 "$output_file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment