0

I would like to resize groups of photos in batch.

I see this tutorial for "Batch Mode" on GIMP.org, but it looks seriously confusing and complicated. I see a few references here on Askubuntu to something called ImageMagick, however, when I went to install it I saw 276 ratings culminating in a one-star review. I started getting depressed reading the reviews.

Please advise.

hoatzin
  • 568
  • 1
    I believe "gimp batch mode" is a Scheme interpreter - basically a variant of the Lisp programing language. But you also have e.g. https://www.gimp.org/docs/python/index.html which is a lot closer to "normal" programming. Python is something you learn quick and may build on a long time after that. – Hannu Jul 26 '22 at 18:03
  • 1
    If you decided to give ImageMagick a try (I've used it successfully in the past - perhaps you could link to these "depressing" reviews?) then see How can I scale all images in a folder to the same width? – steeldriver Jul 26 '22 at 20:00
  • @steeldriver The 276 ratings and reviews I saw in my software center. I don't know how to provide a link to that. Do you? – hoatzin Jul 26 '22 at 22:55
  • @steeldriver The reviews are visible in my "software center". Is there a way to provide a link to them? I ended up using GraphicsMagick which forked off of ImageMagick in 2002. – hoatzin Jul 27 '22 at 21:56

2 Answers2

1

I've been using Imagemagick for batch processing images in Ubuntu for years, and I don't have a single complaint. It's very powerful, which may be why it appears confusing at first.

Here's a simple Bash script using Imagemagick's mogrify command that will prompt you for the width and height of JPG images you want to scale in the current directory, strip the EXIF data, set the interlacing, sampling factor, and quality to prepare the images for the web:

#!/bin/bash
# Get the desired dimensions.
echo 'What maximum width do you want?'
read width
echo 'What maximum height do you want?'
read height
# Scale the images.
for fname in `pwd`/*.jpg; do
  mogrify -resize "${width}x${height}>" -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% $fname
done

Save the file as something like, "scaleimages.sh" in your home directory's ~/bin folder--you may have to create the folder--so it will be in your PATH, and make it executable:

chmod 700 ~/bin/scaleimages.sh

To use it, open Terminal and cd into the folder where the images are that you want to scale, and run:

scaleimages.sh

The script is just an example, and isn't set up to handle file names with spaces, but it shows you how easy it can be to batch things with ImageMagick.

linux4me
  • 416
1

This worked for me:

  1. Put the images I wanted resized into a folder.
  2. Opened the folder into a terminal window.
  3. Installed GraphicsMagick (an active fork of ImageMagick) using sudo apt install graphicsmagick-imagemagick-compat
  4. gm mogrify -geometry 600^x600^ *.png

The gm command shown above worked very quickly to resize all the png images in the directory. The ^ symbol ensures that the image aspect ratio is maintained when the image is resized, but the resulting width or height are treated as minimum values rather than maximum values.

hoatzin
  • 568