Skip to content

Instantly share code, notes, and snippets.

@ReidWilliams
Last active February 22, 2021 05:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ReidWilliams/53845baae2d2d2cc5fe49ca2d7c90b8a to your computer and use it in GitHub Desktop.
Save ReidWilliams/53845baae2d2d2cc5fe49ca2d7c90b8a to your computer and use it in GitHub Desktop.
resize crop with imagemagick
# resize all files in directory <in> so that the shorter dimension (or both dims) is 64 pixels, then
# crop the longer dimension to 64 pixels.
magick convert in/* -resize 64x64^ -gravity center -extent 64x64 'out/%06d.jpg'
# crop images using find / exec. Find / exec is useful when there are many images and file globs don't work.
# Crop to 1150 by 512 at the top, left edge of the image
find ./*.jpg -exec magick convert {} -crop 1150x512+0+0 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment