I want to scale all images in a given folder to the same width (but different appropriately scaled heights). How can I do this using a GUI-based or command-line tool?

For bonus points, is it possible to restrict which images are scaled based on their initial width (that is, only scale images that have a width > x and/or a width < y)?


7 Answers 7


This is very easy to do with imagemagick. You should be able to install it in the Software Center. I would suggest it for batch processing of images.

The batch resizing is incredibly simple (I tested it with Ubuntu 11.10). Use the following command to resize every .jpg file to 200 pixel width, keeping the aspect ratio:

$ convert '*.jpg[200x]' resized%03d.png

you can maintain the filename by using -set option. Ex:

convert "images/*.jpg[250x]" -set filename:base "%[basename]" "images/new_folder/%[filename:base].jpg"

If you have more files you should use with find

find /folder -iname '*.JPG' -exec convert \{} -verbose -set filename:base "%[basename]" -resize 1920x1080\> "/folder/images/%[filename:base].JPG" \;

This is only scratching the surface of the power of imagemagick. Resizing can be tuned endlessly. For more advanced resizing you have to use the -resize option.

You can limit the resizing to shrinking:

$ convert '*.jpg[300x>]' thumb-300-%03d.png

or enlarging:

$ convert '*.jpg[300x<]' thumb-300-%03d.png

Have look at the geometry documentation to see more options.

  • 1
    Why jpg to png?
    – JohnyTex
    Commented Jul 14, 2016 at 13:41
  • 6
    The .jpg and .png extensions are just an example to demonstrate the usage of different formats.
    – bandi
    Commented Jul 20, 2016 at 21:41
  • For more info on the -set option: imagemagick.org/script/command-line-options.php ; basically, -set <property-name> <value> sets a property; %<one-character> and %[<one-or-more-characters>] are expanded by Imagemagick to their value; properties that are used to programmatically determine the output filename need to start with filename:, so we need to copy the base property, containing the image path, into a filename:<something> property.
    – marcotama
    Commented Oct 24, 2017 at 0:26
  • 1
    Thanks for sharing this trick, I did not know!
    – marcotama
    Commented Oct 24, 2017 at 0:33
  • 2
    unknown image property "%[base]"
    – Post Self
    Commented Nov 5, 2017 at 9:34

For GUI, Phatch "one click is worth thousand photos" is the best for such quick job. It is already in Ubuntu repository.

sudo apt-get install phatch
  1. Add Scale & Save item
  2. Set scale/resize options
  3. Set save/output options
  4. Run
  5. Set input folder
  6. Click batch to execute

enter image description here enter image description here

  • 2
    For an upvote, an example how to actually accomplish the task in the question would be nice :) But thanks for the tip, nice tool!
    – jaywink
    Commented Jul 28, 2014 at 7:12
  • 2
    This didn't work on my machine (Ubuntu Mate 16.04). The app was stuck on the startup screen
    – Gunith D
    Commented Feb 4, 2017 at 6:23
  • 1
    @GunithDevasurendra , try it from command line to check for errors. if you couldn't solve it, please write another question and include that output.
    – user.dz
    Commented Feb 6, 2017 at 13:26
  • 2
    Great tool, I used it for years. Unfortunately it is unmaintained and doesn't work in current Ubuntu versions. Hope somebody can fork the code to fix it.
    – Diego V
    Commented Aug 28, 2018 at 15:21
  • On Fedora it's not the same as above and has no such functionality
    – Vlad
    Commented Apr 10, 2019 at 8:19

Try this:

sudo apt-get install gimp-plugin-registry

Then, open up Gimp and open the Batch plugin found in Filters > Batch > Batch Process.

Select your images in the Input tab, and define the Resize operation in the surprisingly-named Resize tab.

More information can be found here.


Try mogrify command from ImageMagick tools.

  • give a path to separate the output from originals
  • give desired thumbnail width or height, below a width example
  • this way you keep the original filename :-)


$ mogrify -path small/ -auto-orient -thumbnail 300x *.jpg
  • 2
    This is the best answer in my opinion!
    – Tom
    Commented Aug 9, 2016 at 16:35
  • 5
    $ mogrify -path small/ -resize 300x *.jpg
    – Yuri
    Commented Jan 12, 2017 at 8:51
  • +1 and you can resize the longest side whether that's for a portrait or landscape rotated image: stackoverflow.com/a/5694903/227926 Commented Sep 28, 2018 at 12:13
  • 1
    +1 I was processing a directory with over 50,000 files. This command worked far better than those in the accepted answer. Calling convert directly resulted in an error ("cache full" or some such) and calling it through find (as described in the accepted answer) was 100x slower.
    – ack_inc
    Commented Feb 14, 2022 at 19:52

Answered and accepted (and I use ImageMagick) but for completeness... I have a non-technical boss that wanted a simple viewer with some basic tools and it had to be GUI. I decided on gThumb for him.

In the thumbnail view you...

  • Select any images you want resized
  • Start the resize function (click the Wrench icon > Resize Images..)
  • Put in a new size based on pixels or percentage
  • Select an output folder, and off you go.
  • For resizing it's a decent alternative to Phatch until it's fixed for 16.04. Commented Jun 6, 2017 at 0:51

Here is how I did it by shrinking only larger images:

find . -iname \*.jpg -exec convert -verbose -quality 80 -resize 1600\> "{}" "FOO_FOLDER/{}" \;

It will appropriately scaled the heights.

To use the convert command, you need to install Imagemagick via sudo apt-get install imagemagick.

For Windows, see: A Batch Script To Resize Images.


For batch image resizing I’ve looked at many packages and finally found one with a usable interface – converseen. Once you discover that the important settings are somewhat hidden on the scrollable left pane, all is well.
Not sure if this meets all of the OPs use cases, but you may not have to look at the quirky UIs of imagemagick or phatch.
Oddly, photo management packages like digikam, f-spot, fotoxx or shotwell don't seem to recognize the need for copying/resizing batches of images before uploading to online services like photobucket or (gag) flickr. These services want us to do things their way only so I do not trust them for backing up originals.

  • Converseen works good, but you must set height to zero px "0", in order to resize only on width while maintaining aspect ratio.
    – TomoMiha
    Commented Mar 19, 2020 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .