Page 1 of 1

Bug with gradient bounding-box?

Posted: 2018-04-06T07:09:30-07:00
by RigacciOrg
Hi,

I'm trying to create an image with a black to transparent gradient region, which fills only half of the image. I have no problem to obtain the gradient in the left-half of the image, like this:

Code: Select all

convert -size 100x200 -define gradient:bounding-box=50x200+0+0 gradient:black-none test.png
but I am unable to create the same gradient in the right-half of the image:

Code: Select all

convert -size 100x200 -define gradient:bounding-box=50x200+50+0 gradient:black-none test.png
It seems that the +x parameter of the bounding-box does not work as expected. I expect e.g. that the gradient region moves 10 pixels to the right using bounding-box=50x200+10+0, but it does not. Am I missing something?

Running Imagemagick 6.9.7.4 on Debian GNU/Linux 9 64bit.

Re: Bug with gradient bounding-box?

Posted: 2018-04-06T08:06:05-07:00
by snibgo
The documentation http://www.imagemagick.org/script/gradient.php doesn't say clearly what "-define gradient:bounding-box WxH+X+Y" does. It gives no examples.

From the code draw.c DrawGradientImage(), the number of pixels that will be set isn't W columns by H rows, but (W-X) columns and (H-Y) rows. I suspect this is a bug. From experiment, it also doesn't start at (X,Y).