possible bug -tint IM 6.8.5.10 Q16 Mac OSX

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

possible bug -tint IM 6.8.5.10 Q16 Mac OSX

Post by fmw42 »

Seems like -tint is producing different results between IM 6.8.5.4 (and before) and 6.8.5.5 (and after)

I believe it may be due to an internal conversion to grayscale using -colorspace gray, which I have reported is using the wrong mixing fractions (see viewtopic.php?f=3&t=23536)

Testing IM 6.8.5.4 and 6.8.5.10


convert rose: -fill magenta -tint 40 1tmp68510.png
Image

im6854 convert rose: -fill magenta -tint 40 1tmp6854.png
Image



convert rose: -color-matrix "\
.3 .6 .1 \
.3 .6 .1 \
.3 .6 .1 \
" \
-fill magenta -tint 40 1tmp68510b.png
Image


im6854 convert rose: -color-matrix "\
.3 .6 .1 \
.3 .6 .1 \
.3 .6 .1 \
" \
-fill magenta -tint 40 1tmp6854b.png
Image
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -tint IM 6.8.5.10 Q16 Mac OSX

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.6-0 Beta available by sometime tomorrow. In addition, use this command:
  • convert rose: -fill magenta -intensity rec601luminance -tint 40 1tmp68510.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -tint IM 6.8.5.10 Q16 Mac OSX

Post by fmw42 »

magick wrote:We can reproduce the problem you posted and have a patch in ImageMagick 6.8.6-0 Beta available by sometime tomorrow. In addition, use this command:
  • convert rose: -fill magenta -intensity rec601luminance -tint 40 1tmp68510.png
In 6.8.5.10, I tested the following and they are all identical in each of the two sets. -intensity made no difference. These results are different from prior to 6.8.5.5 (tested for example with 6.8.5.4 and 6.7.4.10)


convert rose: -fill magenta -tint 40 1tmp68510.png
convert rose: -fill magenta -intensity rec709luminance -tint 40 1tmp68510_rec709luminance.png
convert rose: -fill magenta -intensity rec709luma -tint 40 1tmp68510_rec709luma.png
convert rose: -fill magenta -intensity rec601luminance -tint 40 1tmp68510_rec601luminance.png
convert rose: -fill magenta -intensity rec601luma -tint 40 1tmp68510_rec601luma.png


convert rose: -color-matrix ".3 .6 .1 .3 .6 .1 .3 .6 .1" -fill magenta -tint 40 2tmp68510.png
convert rose: -color-matrix ".3 .6 .1 .3 .6 .1 .3 .6 .1" -fill magenta -intensity rec709luminance -tint 40 2tmp68510_rec709luminance.png
convert rose: -color-matrix ".3 .6 .1 .3 .6 .1 .3 .6 .1" -fill magenta -intensity rec709luma -tint 40 2tmp68510_rec709luma.png
convert rose: -color-matrix ".3 .6 .1 .3 .6 .1 .3 .6 .1" -fill magenta -intensity rec601luminance -tint 40 2tmp68510_rec601luminance.png
convert rose: -color-matrix ".3 .6 .1 .3 .6 .1 .3 .6 .1" -fill magenta -intensity rec601luma -tint 40 2tmp68510_rec601luma.png



In 6.8.6.0 beta, only these 3 nearly match. I am not sure why the first matches both rec601luma and rec601luminance? I would have expected it to only match rec601luma due to gamma differences. Am I mistaken about this?

im67410 convert rose: -fill magenta -tint 40 1tmp67410.png
imb convert rose: -fill magenta -intensity rec601luma -tint 40 1tmp6860_rec601luma.png

imb convert rose: -fill magenta -intensity rec601luminance -tint 40 1tmp6860_rec601luminance.png

compare -metric rmse 1tmp67410.png 1tmp6860_rec601luma.png null:
33.7911 (0.00051562)

compare -metric rmse 1tmp67410.png 1tmp6860_rec601luminance.png null:
33.7911 (0.00051562)

but these do not:

im67410 convert rose: -fill magenta -tint 40 1tmp67410.png
imb convert rose: -fill magenta -tint 40 1tmp6860.png

compare -metric rmse 1tmp67410.png 1tmp6860.png null:
5607.08 (0.0855585)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -tint IM 6.8.5.10 Q16 Mac OSX

Post by magick »

Fully saturated white returns the same value for Luma and Luminance. Try, for example, 'rgb(67%,0,34%)'. As expected it returns different results for Rec601Luma and Rec601Luminance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -tint IM 6.8.5.10 Q16 Mac OSX

Post by fmw42 »

magick wrote:Fully saturated white returns the same value for Luma and Luminance. Try, for example, 'rgb(67%,0,34%)'. As expected it returns different results for Rec601Luma and Rec601Luminance.

That is not what I get from the beta I downloaded earlier today. I am downloading the latest beta and will report back shortly.


im67410 convert -size 100x100 xc:"rgb(67%,0,34%)" -fill magenta -tint 40 1tmp67410.png
imb convert -size 100x100 xc:"rgb(67%,0,34%)" -fill magenta -tint 40 1tmp6860.png
imb convert -size 100x100 xc:"rgb(67%,0,34%)" -fill magenta -intensity rec709luminance -tint 40 1tmp6860_rec709luminance.png
imb convert -size 100x100 xc:"rgb(67%,0,34%)" -fill magenta -intensity rec709luma -tint 40 1tmp6860_rec709luma.png
imb convert -size 100x100 xc:"rgb(67%,0,34%)" -fill magenta -intensity rec601luminance -tint 40 1tmp6860_rec601luminance.png
imb convert -size 100x100 xc:"rgb(67%,0,34%)" -fill magenta -intensity rec601luma -tint 40 1tmp6860_rec601luma.png


Both luma an luminance are the same for each of 601 and 709

imb compare -metric rmse 1tmp6860_rec601luma.png 1tmp6860_rec601luminance.png null:
0 (0)

imb compare -metric rmse 1tmp6860_rec709luma.png 1tmp6860_rec709luminance.png null:
0 (0)


But equally as important is that the version without -intensity matches the rec709 version and should be matching the rec601 version

imb compare -metric rmse 1tmp6860.png 1tmp6860_rec601luma.png null:
6119.4 (0.0933761)

imb compare -metric rmse 1tmp6860.png 1tmp6860_rec709luma.png null:
0 (0)

I think this issue is likely somehow connected to the colorspace gray bug report at viewtopic.php?f=3&t=23536

I just download the most current beta and the results are still as above.

ImageMagick-6.8.6-0...> 2013-06-10 19:37 7.8M
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -tint IM 6.8.5.10 Q16 Mac OSX

Post by magick »

Its the tint color that we extract the intensity. The image itself does not use intensity. Try this:
  • -> convert rose: -fill "rgb(67%,0,34%)" -intensity rec709luminance -tint 40 rec709luminance.png
    -> convert rose: -fill "rgb(67%,0,34%)" -intensity rec601luminance -tint 40 rec601luminance.png
    -> compare -metric rmse rec709luminance.png rec601luminance.png null:
    1881.17 (0.0287049)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -tint IM 6.8.5.10 Q16 Mac OSX

Post by fmw42 »

Here are the tests again.


im67410 convert rose: -fill "rgb(67%,0,34%)" -tint 40 1tmp67410.png
imb convert rose: -fill "rgb(67%,0,34%)" -tint 40 1tmp6860.png
imb convert rose: -fill "rgb(67%,0,34%)" -intensity rec709luminance -tint 40 1tmp6860_rec709luminance.png
imb convert rose: -fill "rgb(67%,0,34%)" -intensity rec709luma -tint 40 1tmp6860_rec709luma.png
imb convert rose: -fill "rgb(67%,0,34%)" -intensity rec601luminance -tint 40 1tmp6860_rec601luminance.png
imb convert rose: -fill "rgb(67%,0,34%)" -intensity rec601luma -tint 40 1tmp6860_rec601luma.png

Here you are right that luma an luminance are different:

imb compare -metric rmse 1tmp6860_rec601luma.png 1tmp6860_rec601luminance.png null:
5213.82 (0.0795578)

imb compare -metric rmse 1tmp6860_rec709luma.png 1tmp6860_rec709luminance.png null:
3585.13 (0.0547056)

But the default without -intensity is still matching the wrong -intensity. It should match rec601luma and it matches rec709luma

imb compare -metric rmse 1tmp6860.png 1tmp6860_rec601luma.png null:
3508.98 (0.0535436)

imb compare -metric rmse 1tmp6860.png 1tmp6860_rec709luma.png null:
0 (0)

And it does not match pre 6.8.5.5 IM for the same command

imb compare -metric rmse 1tmp6860.png 1tmp67410.png null:
3508.98 (0.0535436)

I still think this may be related to my issue with -colorspace gray matching rec709luma and not rec601luma. See viewtopic.php?f=3&t=23536
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -tint IM 6.8.5.10 Q16 Mac OSX

Post by fmw42 »

For anyone interested, this is not a bug. IM recently changed the default -colorspace gray from rec601luma to rec709luma to conform better to sRGB standards. A brief reference can be found at http://en.wikipedia.org/wiki/HSL_and_HSV under lightness. This also affects -tint.
Post Reply