Page 1 of 1

Operate on just one image in an image list?

Posted: 2009-11-29T22:29:37-07:00
by rling
Hello
I want to use IM to separate an RGB image into three greyscale images, resize the channels independently and then recombine them. I'd like to do it in one command line if possible. Is it possible to select that the -resize operator only applies to a selected one of the images?

For example, using an imaginary operator "-select":

convert foo.jpg -separate -select 1 -resize 100x100 -select 2 -resize 150x150 -select 3 -resize 200x200 -combine foo2.jpg

thanks...

Re: Operate on just one image in an image list?

Posted: 2009-11-30T10:27:34-07:00
by fmw42
you can use clone and parenthesis processing (see http://www.imagemagick.org/Usage/basics/#image_seq )

BUT you cannot recombine (-combine) the images if they are not the same size. So you would have to pad them back to the same size first.


convert zelda3.png -separate \
\( -clone 0 -resize 75% -gravity center -background black -extent 128x128 \) \
\( -clone 1 -resize 50% -gravity center -background black -extent 128x128 \) \
\( -clone 2 -resize 25% -gravity center -background black -extent 128x128 \) \
-delete 0-2 -combine zelda3_tmp.png

Re: Operate on just one image in an image list?

Posted: 2009-11-30T12:48:34-07:00
by rling
Lovely. Thankyou.

Re: Operate on just one image in an image list?

Posted: 2009-11-30T17:52:11-07:00
by anthony