I have about 4000 images that need to be cropped. The task is rather simple really. They all have a white border that varies but is always between say 20 and 50 pixels. I want to use graphics magick to remove that white border from all the images. How?

3 Answers 3


The GraphicsMagick -trim operator here. Does what I need. Thanks for the other suggestions.


You could write a php script that crops all of the images.


  • This suffers the same issue as the above (only crops fixed sized borders).
    – unixman83
    Commented Apr 26, 2012 at 15:10

You can batch crop & resize images with the free IrfanView tool

  • Unfortunately the borders on the images vary. I can't tell IfranView to just crop all images by 20 px on each side. That would crop some of the content of some of my images.
    – unixman83
    Commented Apr 26, 2012 at 15:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.