Page 1 of 1

draw "image over" not working in 6.6.9-1

Posted: 2011-04-24T17:38:48-07:00
by jwhitlock
Under ImageMagick 6.5.8-10, we run a command like this:

Code: Select all

convert -size 160x120 xc:black -format png  -draw "image over 0,0 160,120 'images/in1.jpg'" out.png
This pastes the image 'images/in1.jpg' over the black background. The actual command is much longer, but this is the minimum to reproduce the issue. Under ImageMagick 6.6.9-1, this same command produces a 160x120 black image. The command to get the expected result for the for the later version is:

Code: Select all

convert -size 160x120 xc:black -format png  -draw "image src-over 0,0 160,120 'images/in1.jpg'" out.png
The current documentation says that 'over' is the same as 'src-over', so either the documentation is wrong, or the alpha composting code is wrong.

We're using ImageMagick 6.5.8-10 in production, on a CentOS 5.2 virtual machine:
Version: ImageMagick 6.5.8-10 2010-05-26 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
I'm using the later version on my laptop, OS X, installed with macports:
Version: ImageMagick 6.6.9-1 2011-04-12 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP OpenCL
Thanks for the awesome product.

Re: draw "image over" not working in 6.6.9-1

Posted: 2011-04-24T17:57:57-07:00
by fmw42
First -format is of no use, it is used in mogrify and not convert.

Second there appears to be no image over according to http://www.imagemagick.org/script/magic ... aphics.php So you should use either src-over, src-atop or overlay, i.e. any one of the listed compose methods on this page

It appears that perhaps something has changed recently or Anthony's page at http://www.imagemagick.org/Usage/layers/#draw is in error or outdated.

Also your syntax may be a bit off in its quotes.

The following works for me in IM 6.6.9.6 Q16 Mac OSX Tiger (but does not work as you say with "image over").

convert -size 128x128 xc:black -draw "image src-over 0,0 128,128 'zelda3.jpg'" out.png

Anthony or one of the other IM developers will have to comment on any possible change in the use of image over, if it properly existed at one time.

Re: draw "image over" not working in 6.6.9-1

Posted: 2011-04-24T19:31:30-07:00
by jwhitlock
Thanks. Yes, I hand-modified the command, and got the quotes wrong around the file name. I edited my post to fix it (it used to say -draw 'image over 0,0 160,120 images/in1.jpg', but the filename images/in1.jpg must be quoted as well).

I used a different document for looking at the draw image options. This page documents all the command line options:

http://www.imagemagick.org/script/comma ... s.php#draw

It points to this page for the Alpha Composting options:

http://www.imagemagick.org/script/compose.php

That page says:
Any of the 'Src-*' methods can also be specified without the 'Src-' part. For example the default compose method can be specified as just 'Over'.
So, if that is no longer the case, then that page should be changed.

Re: draw "image over" not working in 6.6.9-1

Posted: 2011-04-24T19:39:58-07:00
by fmw42
Anthony recently modified some of the compose methods to have alternate names. Perhaps at that time things broke for -draw. see divide and minus at http://www.imagemagick.org/Usage/compose/#math, though I am not sure I see any connection. Hopefully Anthony will respond to this once he gets a chance. As you say one or the other pages (Examples or Options) needs to be modified about the "over" option for -draw.

Re: draw "image over" not working in 6.6.9-1

Posted: 2011-04-24T20:14:52-07:00
by anthony
Nope it is working correctly, at least the actual compose operation.

Code: Select all

convert -size 160x120 xc:black  image.jpg -composite show:
However the original problem does fail.

Code: Select all

convert -size 160x120 xc:black -draw "image over 0,0 0,0 'image.jpg'" show:
Using 0,0 for the size removes the 'resize' aspect of the draw image command.

The JPEG does not matter, no image appear using draw.
Nor does ensuring that the canvas has an alpha channel.

Basically something is juts wrong with draw 'image'.

Re: draw "image over" not working in 6.6.9-1

Posted: 2011-04-27T09:22:15-07:00
by Mark Sirota
I can confirm that this issue still exists in 6.6.9-6. "srcover", "src-over", and "SrcOver" all work properly (though "srcover" and "src-over" are not listed in "-list compose").

Re: draw "image over" not working in 6.6.9-1

Posted: 2011-04-27T10:00:47-07:00
by magick
We're working on a patch for ImageMagick 6.6.9-7 Beta to fix this problem. Look for a fix within the next few days. Thanks.

Re: draw "image over" not working in 6.6.9-1

Posted: 2011-05-02T12:23:21-07:00
by Mark Sirota
Confirmed fixed in 6.6.9-7. Thanks!