Page 1 of 1

Rotating and flattening produces white image

Posted: 2007-06-04T09:14:25-07:00
by martinw17
I am using ImageMagick 6.3.4 06/01/07 Q16 on Windows.

If I run the following command:
convert test.psd -affine -1,0,0,-1,0,0 -transform rotated.jpg

Then the result is the image rotated (as a jpeg), as expected. However, if I want to flatten the layers, e.g.
convert test.psd -affine -1,0,0,-1,0,0 -transform -flatten rotated-flattened.jpg

then the result is a white image.
This happens regardless of the source format, e.g.
convert test.jpg-affine -1,0,0,-1,0,0 -transform -flatten rotated-flattened.jpg
does the same.

Is this a bug or am I doing something wrong?

Thanks,
Martin

Re: Rotating and flattening produces white image

Posted: 2007-06-04T20:32:36-07:00
by anthony
You rotated the image out of the positive position space! Remember all affine transforms takes into account any negatge offsets the result image may get, though few image formats understand a negative offset. As such saving the roatted image to say JPEG shows the image rotated, but flattening directly does not see a negativally positioned image!

As such no image was in the area when flattened.

You need to junk the image offset using +repage or adjust your affine with an appropriate offset.

For full details see IM examples, Position of Affine Results
http://www.imagemagick.org/Usage/distorts/#affine_pos
Also see, Affine Result Re-Positioning...
http://www.imagemagick.org/Usage/distorts/#affine_repos

Re: Rotating and flattening produces white image

Posted: 2007-06-05T02:22:51-07:00
by martinw17
Thanks Anthony.
I read through your examples and it makes sense now. In fact, as all I was trying to achieve was rotation, I have switched to using the -rotate option.

Re: Rotating and flattening produces white image

Posted: 2007-06-05T03:13:42-07:00
by anthony
It is faster and simplier to use if that is all you want.

If you jkust want to flip or flop the image that is posible too.
See the top of the Image distortion page.
http://www.imagemagick.org/Usage/distorts/