Page 1 of 1

Horizontal gradient bug

Posted: 2016-10-01T16:48:10-07:00
by snibgo
Tested under v6.9.5-3 pre-built Windows binary and other v6 versions. Windows 8.1

Code: Select all

convert ^
  -size 5x5 ^
  -define gradient:direction=West ^
  gradient: ^
  -scale 5000%% ^
  grad_bug.png
Image
As can be seen, the top-right pixel is the wrong colour.

This also happens at other sizes.

Re: Horizontal gradient bug

Posted: 2016-10-01T17:07:03-07:00
by fmw42
Good catch. I can confirm the same on IM 6.9.5.10 Q16 Mac OSX.

It does not happen with the older style (no define) approach.

Code: Select all

convert -size 5x5 gradient: -rotate 90 -scale 5000% result.png

Re: Horizontal gradient bug

Posted: 2016-10-02T07:35:02-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.

Re: Horizontal gradient bug

Posted: 2016-10-02T08:24:07-07:00
by GeeMack
As an additional note, this issue also occurs with ImageMagick 7.0.3-1 on Windows 10 64. This command...

Code: Select all

magick ^
   -gravity center -pointsize 48 -fill tan -bordercolor tan -size 5x5 ^
   ( -define gradient:direction=north gradient: -scale 3000% -annotate +0+0 "N" ) ^
   ( -define gradient:direction=east gradient: -scale 3000% -annotate +0+0 "E" ) ^
   ( -define gradient:direction=south gradient: -scale 3000% -annotate +0+0 "S" ) ^
   ( -define gradient:direction=west gradient: -scale 3000% -annotate +0+0 "W" ) ^
   -border 4x4 +append -border 4x4 grad_bug.png
... produces this output...

Image

Also, when defining the direction as a diagonal, the northwest and southwest gradients don't go all the way to white, as with this example command...

Code: Select all

magick ^
   -gravity center -pointsize 48 -fill tan -bordercolor tan -size 5x5 ^
   ( -define gradient:direction=northeast gradient: -scale 3000% -annotate +0+0 "NE" ) ^
   ( -define gradient:direction=southeast gradient: -scale 3000% -annotate +0+0 "SE" ) ^
   ( -define gradient:direction=northwest gradient: -scale 3000% -annotate +0+0 "NW" ) ^
   ( -define gradient:direction=southwest gradient: -scale 3000% -annotate +0+0 "SW" ) ^
   -border 4x4 +append -border 4x4 grad_diag.png
... which creates this image...

Image

These issues occur when using the default "gradient:" or when setting particular colors like "gradient:white-black" or even "gradient:red-blue".

Re: Horizontal gradient bug

Posted: 2016-10-31T10:22:38-07:00
by fmw42
I am not sure when these were fixed, but they seem to work in IM 6.9.6.2 and IM 7.0.3.4