Gradient masks - any recent changes?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gnidam
Posts: 4
Joined: 2011-06-15T13:58:27-07:00
Authentication code: 8675308
Location: Vienna

Gradient masks - any recent changes?

Post by gnidam »

Hi all,

until version (Linux)

Code: Select all

Version: ImageMagick 6.8.9-10 Q16 x86_64 2015-03-03 
Features: DPC Modules OpenMP
using a gradient mask this way:

Code: Select all

convert -depth 16 -size 1x4096 gradient: -flip -write mpr:gradient \
    \( mpr:gradient -sigmoidal-contrast 8x50% \) \( mpr:gradient \) \
    -composite imtest.tif
worked just fine, leading to (graph from gradient): Image

With later versions

Code: Select all

Version: ImageMagick 6.9.1-0 Q16 x86_64 2015-03-29 
Features: DPC Modules OpenMP
however, i just get (again the graph): Image

So the gradient mask seems not to be applied.
I couldn't find anything in the changelog why that happens... so have I been doing this wrong all along or is it a bug?

Thx,
Martin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Gradient masks - any recent changes?

Post by fmw42 »

I would have to agree. Assuming you are using a 3 image composite and the last is the mask, then all three of these show the same results for me on IM 6.9.1.0 Q16 Mac OSX, which is identical to just the sigmoidal-contrast image.

Code: Select all

convert -size 1x256 gradient: -rotate 90 -write mpr:gradient \
\( mpr:gradient -sigmoidal-contrast 8x50% \) \( mpr:gradient \) \
-compose over -composite miff:- | profile -f 1 - show:

Code: Select all

convert -size 1x256 gradient: -rotate 90 \
\( -clone 0 -sigmoidal-contrast 8x50% \) \( -clone 0 \) \
-compose over -composite miff:- | profile -f 1 - show:

Code: Select all

convert -size 1x256 gradient: -rotate 90 -sigmoidal-contrast 8x50% miff:- | profile -f 1 - show:

whereas swapping the first two images leads to a linear profile

Code: Select all

[code]convert -size 1x256 gradient: -rotate 90 -write mpr:gradient \
\( mpr:gradient -sigmoidal-contrast 8x50% \) +swap \( mpr:gradient \) \
-compose over -composite miff:- | profile -f 1 - show:
[/code]


That would indicate to me that the masked composite is not working correctly.
gnidam
Posts: 4
Joined: 2011-06-15T13:58:27-07:00
Authentication code: 8675308
Location: Vienna

Re: Gradient masks - any recent changes?

Post by gnidam »

Btw, thresholding the composite mask works as expected:

Code: Select all

convert -size 1x265 gradient: -flip \
    \( -clone 0 -sigmoidal-contrast 8x50% \) \
    \( -clone 0 -threshold 50% \) \
    -composite imtest3.tif
Image

...so midtones in the mask don't have any effect, just maxval give full opacity?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Gradient masks - any recent changes?

Post by snibgo »

I agree there is a bug. It is a weird one. Comparing v6.9.0-0 with 6.9.1-0, Windows BAT syntax:

These give the same correct outputs:

Code: Select all

%IMG690%convert ^
  -size 1x4096 ^
  xc:black ^
  ( xc:white ) ^
  ( gradient:black-white ) ^
  -compose Over -composite imtest4.tif

%IMG691%convert ^
  -size 1x4096 ^
  xc:black ^
  ( xc:white ) ^
  ( gradient:black-white ) ^
  -compose Over -composite imtest4a.tif
If we change "xc:black" to "gradient:black-black" ...

Code: Select all

%IMG690%convert ^
  -size 1x4096 ^
  gradient:black-black ^
  ( xc:white ) ^
  ( gradient:black-white ) ^
  -compose Over -composite imtest5.tif

%IMG691%convert ^
  -size 1x4096 ^
  gradient:black-black ^
  ( xc:white ) ^
  ( gradient:black-white ) ^
  -compose Over -composite imtest5a.tif
... the 691 output is entirely white.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Gradient masks - any recent changes?

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.9.1-1 Beta within the next few days. Thanks.
Post Reply