views:

249

answers:

3

Is there a way to adjust all image sizes in a directory? If I set the max size to 800x600 it will make larger ones smaller and leave smaller ones at their original size.

Has anyone got a solution for that? Any help would really be appreciated!

+1  A: 

image magick package needs to be installed: mogrify -resize 320x240 *.jpg where 320 = width, 240 = height

or you can just leave width parameter: mogrify -resize 320 *.jpg and rest will be taken care of.

dusoft
+1  A: 

Various packages exist for command line or script driven manipulation of image files.

I'd suggest looking at netpbm, or ImageMagick. Personally I prefer the former as it's far simpler to use.

Alnitak
+12  A: 
for img in *.png; do
    convert "$img" "800x600>" $(basename "$img" .png)_new.png
done

convert is from ImageMagick. ">" says it's only resized if larger. See here for its other options.

Johannes Schaub - litb
nice hint about the '>' option!
Alnitak