I'm using GIMP2 to crop product photos, then I have to resize them to 690x690, then export them in .png and .jpg to PNG and JPG folders. It's so repetetive, I tried BATCH but every image is diferent so it doesn't help.

  • By different, do you mean you need to crop it in different places? For example, the product isn't necessarily centered or might take up a different portion of the frame compared to another image? Nov 3 '16 at 12:56

Use ImageMagick's convert command, something like:

convert NNNNN.jpg -geometry 690x690 -quality 85 JPG/NNNN.jpg
convert NNNNN.jpg -geometry 690x690 PNG/NNNN.png

Insert in a shell script/.BAT. You can have a more complex processing, for instance you can recover some sharpness and add contrast:

convert NNNNN.jpg -modulate 100,120 -sharpen 0x1.0 -geometry 690x690 -quality 85 JPG/NNNN.jpg
convert NNNNN.jpg -modulate 100,120 -sharpen 0x1.0 -geometry 690x690 PNG/NNNN.png
  • It's worth pointing out that mogrify, which is part of imagemagic, can do most of the same stuff as convert, but on multiple files, eliminating the need to use a script or .bat file in most common use-cases. Nov 3 '16 at 13:44

Treating images in bulk like this can be done with the ImageMagic tool mogrify, which is a free command line program available on most platforms.

Note: Imagemagick actually includes many programs, such as identify and convert. The mogrify program is simiar to convert but is intended for operating on multiple files. If you need a lot of control and complicated logic, using convert in a script will be more flexible, but is generally not necessary.

There are two modes of operations in mogrify that would be of interest to you: -crop and -trim. Crop requires you to tell it how much space you want to cut on the ends of the image and how you want to offset it. Trim attempts to get rid of excess outer space on its own.

The following example will crop all JPG in the current directory to 960×960 relative to the center.

mogrify -crop 690x690+0+0 -gravity Center *.jpg

Below is another example that will also change the images geometry

mogrify -geometry 690x690^ -gravity center -crop 690x690+0+0 *.jpg

The -trim operator is different and tries to crop an image by removing outer padding like white space and transparency. The -fuzz option can be used to get rid of space that might not be a consistent color, which is likely the case in product photos.

mogrify -fuzz 1% -trim *.jpg


Take a small set of your image and try a few different mogrify commands and see if you can get the results you want. Imagemagick is very well documented and there's lots of examples out there.

Accept that it won't be perfect.

mogrify is an axe. It can do a huge amount of work that would otherwise take a long time to do by hand. It may also miss. If I can get Imagemagick to do 80-90% of the work, I'm usually willing to pull out my proverbial scalpel and finish the rest.


Perhaps the most difficult part is to crop the images, since it can be different images (size, location of what you want to crop, etc). If the images you want to work out are more or less in the same graphic arrange you can try the crop commands given before (imagemagick is really good). Other than that, it's better to pick up one image at the time.

For batch process there is the David's Batch Processor GIMP plugin and BIMP (Batch Image Manipulation Plugin). Both are good ones. David's plugin is more stable while BIMP has a bit more of newer options. Give a try to both!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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