Imagemagick converting horizontal images

Florian Diesch diesch at spamfence.net
Fri Feb 23 23:57:33 UTC 2007


Marcanth <marcanth2001 at yahoo.com> wrote:

> I have about 30 images and would like to resize only the horizontal ones.
> How could I do this with ImageMagick -resize option? Example:
>
> image01.jpg (width: 400, height: 200). This image (horizontal) will be
> resized to, let's say, 200x100.
>
> image02.jpg (width: 100, height: 500). This one is vertical, so it will not
> be affected.
>
> How could I do this?

Not tested:

cat your_files_one_line_per_file_name| while read file; do
 if eval "`identify -format 'test %h -gt %w' $file`"; then
   convert -resize what_ever $file some_dir/$file
 fi
done





   Florian
-- 
<http://www.florian-diesch.de/>




More information about the ubuntu-users mailing list