Login  Register

Re: Macro for ImageResize

Posted by Jim Passmore on Nov 19, 2010; 2:09pm
URL: http://imagej.273.s1.nabble.com/Macro-for-ImageResize-tp3686379p3686382.html

Frank,

Replace 'convert' with the ImageMagick 'mogrify' command.  I think it would
then be
mogrify -resize 800x600^ *.jpg

Caution:  BACKUP your data first!!!!  The mogrify command overwrites the
original file with the changed file!

Also, as is frequently pointed out on this list, think twice about the jpeg
format.  Every time you save a jpeg, you degrade the quality, so if you're
going to to any later processing, measurement, etc., you may be hurting the
results.  (If this is the last operation on these images and you need the
smaller file size, then jpeg is probably acceptable.)

Therefore, another (better?) command producing a second file name might use
the mogrify -format option.  I think this is the only time mogrify produces
a new file instead of overwriting the first.
mogrify -resize 800x600^ -format tif *.jpg

If you're already adept with ImageJ, Johannes' suggestion might be easier.

Regards,

*Jim Passmore*
Research Associate
Sealed Air Corporation
[hidden email]
864-433-2927 voice
864-433-2205 fax


On Fri, Nov 19, 2010 at 7:16 AM, Frank Walter <[hidden email]> wrote:

> Michael,
>
> thank you very much. This works very easy, e.g.:
>
> convert * -resize '800x600' output.jpg
>
> or
>
> convert * -resize '800x600^' output.jpg
>
> if I want to keep the bigger size as minimum. Only question (off topic
> because imagemagick):
>
> how can I keep the original names?
>
> Thank you.
>
> Regards, franc
>
>
>
>
>
> > -----Original Message-----
> > Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von
> > Michael Doube
> > Gesendet: Freitag, 19. November 2010 11:49
> > An: [hidden email]
> > Betreff: Re: Macro for ImageResize
> >
> >
> > Franc,
> >
> > > I need a tool on my Ubuntu-server (without GUI) to adjust the size of
> > > all images in one folder to maximum 800x600 pixels (only if they are
> > > bigger), not loosing proportions.
> >
> > Imagemagick does this, and you may already have it on your Ubuntu box.
> > http://www.imagemagick.org/script/convert.php
> >
> > Michael
>