6

Let's say I have a directory full of flags (200 or so). Each flag has this border... 12px up and down and 1px left and rigtht.... like so:

enter image description here

How can I use imagemagick to like... crop every single .PNG image from 64x64 to 60x40

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
test
  • 17,706
  • 64
  • 171
  • 244
  • Note that your background is not white, but transparent, in the image included in the question. – mmgp Dec 31 '12 at 14:12
  • Huh.. ah I see... transparent background -- thank you. – test Dec 31 '12 at 19:54
  • 1
    http://askubuntu.com/questions/97695/is-there-a-lightweight-tool-to-crop-images-quickly || PHP custom color: http://stackoverflow.com/questions/9567816/trimming-images-with-imagick || http://superuser.com/questions/654557/how-to-auto-trim-scanned-images-using-imagemagick-or-graphicsmagick – Ciro Santilli OurBigBook.com Oct 05 '15 at 22:12

1 Answers1

11

You have the automatic crop: mogrify -trim flag.png. If it does not do the exact magic you want, use crop: mogrify -crop 60x40+2+12 flag.png (That is 2 pixels left).

kmkaplan
  • 18,655
  • 4
  • 51
  • 65