this post was submitted on 13 Feb 2026
37 points (97.4% liked)

Linux

12303 readers
487 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
 

Hello everyone, does anyone know of a batch resizing tool on Linux that can resize loads of images all at once while keeping all the images the same aspect ratio as before? I would like to make all my images in a game have either a width of at least 128 px or height of 192 px (e.g. an image that is 700x875 would resize down to 154x192px, so that width is > 128 px and height = 192 px. I think for most of the images resizing based on height will work, but you never know!)

edit: I have used a for loop that cds into each directory, uses imagemagick to resize all of them to fill/overflow area 128x192 with ^ tag and using morgify to modify in place, then cd back to the parent directory! Thanks everyone

you are viewing a single comment's thread
view the rest of the comments
[–] HaraldvonBlauzahn@feddit.org 1 points 13 hours ago* (last edited 13 hours ago)

You can simplify the for loop by something like

#!/bin/bash
shopt -s globstar             #assuming bash
for i in images/**/*.gif 
do
     convert ..... $f
done

or, if you don't use bash,

find images/ -type f -name '*.gif' -print0 | xargs -0 convert .... '{}' 
# maybe xargs needs "-1" option to process only one file at a time

both versions call imagemagick's convert on all files ending in .gif in the images folder.

For testing, put an "echo" command in front of the "convert" .

You could also check out if there are Rust utilities which do what you want - you'd need to install these using "cargo install".