Horizontal gradient bug

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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Horizontal gradient bug

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

Re: Horizontal gradient bug

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

Re: Horizontal gradient bug

Post 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.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Horizontal gradient bug

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

Re: Horizontal gradient bug

Post 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
Post Reply