draw "image over" not working in 6.6.9-1

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jwhitlock
Posts: 2
Joined: 2011-04-24T16:27:28-07:00
Authentication code: 8675308

draw "image over" not working in 6.6.9-1

Post 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.
Last edited by jwhitlock on 2011-04-24T19:26:09-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
jwhitlock
Posts: 2
Joined: 2011-04-24T16:27:28-07:00
Authentication code: 8675308

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post 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'.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
Mark Sirota
Posts: 19
Joined: 2011-04-27T09:04:26-07:00
Authentication code: 8675308
Location: Philadelphia, PA, USA

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

Post 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").
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
User avatar
Mark Sirota
Posts: 19
Joined: 2011-04-27T09:04:26-07:00
Authentication code: 8675308
Location: Philadelphia, PA, USA

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

Post by Mark Sirota »

Confirmed fixed in 6.6.9-7. Thanks!
Post Reply