I am not sure if this is bug or if I misunderstand -tint. However, the results for tinting a gradient with primary and secondary colors seems inconsistent.
Why are the results for yellow and cyan different in location of the gradient than for magenta (and red, green, blue)?
convert grad.png -fill red -tint 30 red.png
convert grad.png -fill green -tint 30 green.png
convert grad.png -fill blue -tint 30 blue.png
convert grad.png -fill magenta -tint 30 magenta.png
convert grad.png -fill yellow -tint 30 yellow.png
convert grad.png -fill cyan -tint 30 cyan.png
possible bug -tint 6.8.7.6 Q16 Mac OSX
Re: possible bug -tint 6.8.7.6 Q16 Mac OSX
The -tint image requires an RGB image. We'll look into supporting CMYK.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug -tint 6.8.7.6 Q16 Mac OSX
The input was not CMYK. It is PNG which does not support CMYK.
The input image was grayscale created by
convert -size 256x256 gradient: -rotate 90 grad.png
Note that with green the darker part extends further to the right than in the red and blue results
Here are the same commands with -colorspace sRGB added and using rgb colors:
convert grad.png -colorspace sRGB -fill "rgb(255,0,0)" -tint 30 red2.png
convert grad.png -colorspace sRGB -fill "rgb(0,255,0)" -tint 30 green2.png
convert grad.png -colorspace sRGB -fill "rgb(0,0,255)" -tint 30 blue2.png
convert grad.png -colorspace sRGB -fill "rgb(255,0,255)" -tint 30 magenta2.png
convert grad.png -colorspace sRGB -fill "rgb(255,255,0)" -tint 30 yellow2.png
convert grad.png -colorspace sRGB -fill "rgb(0,255,255)" -tint 30 cyan2.png
I am not sure that -colorspace sRGB changed the colorspace to RGB, so I modified the gradient as follows to get a colorspace RGB gradient. But the results are much the same.
convert grad.png -depth 8 \
\( -clone 0 -fill "gray(1)" -opaque black \) \
\( -clone 0 -fill "gray(2)" -opaque black \) \
-combine -colorspace sRGB grad2.png
convert grad2.png -colorspace sRGB -fill "rgb(255,0,0)" -tint 30 red3.png
convert grad2.png -colorspace sRGB -fill "rgb(0,255,0)" -tint 30 green3.png
convert grad2.png -colorspace sRGB -fill "rgb(0,0,255)" -tint 30 blue3.png
convert grad2.png -colorspace sRGB -fill "rgb(255,0,255)" -tint 30 magenta3.png
convert grad2.png -colorspace sRGB -fill "rgb(255,255,0)" -tint 30 yellow3.png
convert grad2.png -colorspace sRGB -fill "rgb(0,255,255)" -tint 30 cyan3.png
Perhaps the green channel is not being handled properly?
PS I get similar results with
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,0,0)" -tint 30 red4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,255,0)" -tint 30 green4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,0,255)" -tint 30 blue4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,0,255)" -tint 30 magenta4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,255,0)" -tint 30 yellow4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,255,255)" -tint 30 cyan4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,0,0)" -tint 30 red4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,255,0)" -tint 30 green4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,0,255)" -tint 30 blue4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,0,255)" -tint 30 magenta4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,255,0)" -tint 30 yellow4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,255,255)" -tint 30 cyan4.jpg
So it is not a png issue.
The input image was grayscale created by
convert -size 256x256 gradient: -rotate 90 grad.png
Note that with green the darker part extends further to the right than in the red and blue results
Here are the same commands with -colorspace sRGB added and using rgb colors:
convert grad.png -colorspace sRGB -fill "rgb(255,0,0)" -tint 30 red2.png
convert grad.png -colorspace sRGB -fill "rgb(0,255,0)" -tint 30 green2.png
convert grad.png -colorspace sRGB -fill "rgb(0,0,255)" -tint 30 blue2.png
convert grad.png -colorspace sRGB -fill "rgb(255,0,255)" -tint 30 magenta2.png
convert grad.png -colorspace sRGB -fill "rgb(255,255,0)" -tint 30 yellow2.png
convert grad.png -colorspace sRGB -fill "rgb(0,255,255)" -tint 30 cyan2.png
I am not sure that -colorspace sRGB changed the colorspace to RGB, so I modified the gradient as follows to get a colorspace RGB gradient. But the results are much the same.
convert grad.png -depth 8 \
\( -clone 0 -fill "gray(1)" -opaque black \) \
\( -clone 0 -fill "gray(2)" -opaque black \) \
-combine -colorspace sRGB grad2.png
convert grad2.png -colorspace sRGB -fill "rgb(255,0,0)" -tint 30 red3.png
convert grad2.png -colorspace sRGB -fill "rgb(0,255,0)" -tint 30 green3.png
convert grad2.png -colorspace sRGB -fill "rgb(0,0,255)" -tint 30 blue3.png
convert grad2.png -colorspace sRGB -fill "rgb(255,0,255)" -tint 30 magenta3.png
convert grad2.png -colorspace sRGB -fill "rgb(255,255,0)" -tint 30 yellow3.png
convert grad2.png -colorspace sRGB -fill "rgb(0,255,255)" -tint 30 cyan3.png
Perhaps the green channel is not being handled properly?
PS I get similar results with
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,0,0)" -tint 30 red4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,255,0)" -tint 30 green4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,0,255)" -tint 30 blue4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,0,255)" -tint 30 magenta4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,255,0)" -tint 30 yellow4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,255,255)" -tint 30 cyan4.png
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,0,0)" -tint 30 red4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,255,0)" -tint 30 green4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,0,255)" -tint 30 blue4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,0,255)" -tint 30 magenta4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(255,255,0)" -tint 30 yellow4.jpg
convert -size 256x256 gradient: -rotate 90 -colorspace sRGB -fill "rgb(0,255,255)" -tint 30 cyan4.jpg
So it is not a png issue.
Re: possible bug -tint 6.8.7.6 Q16 Mac OSX
To get symmetric results, you need an intensity that is symmetric. Try average instead of the default Rec709Luma:
- convert grad.png -intensity average -fill "rgb(0,255,0)" -tint 30 tint.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug -tint 6.8.7.6 Q16 Mac OSX
magick wrote:To get symmetric results, you need an intensity that is symmetric. Try average instead of the default Rec709Luma:
- convert grad.png -intensity average -fill "rgb(0,255,0)" -tint 30 tint.png
That does not quite seem to work for me -- the C,M,Y do not seem quite the same as the R,G,B. The C,M,Y have a broader dark region than the R,G,B. At least that is the way it looks to me.
But see further down my fx experiment
convert grad.png -intensity average -fill "rgb(255,0,0)" -tint 30 tint_red.png
convert grad.png -intensity average -fill "rgb(0,255,0)" -tint 30 tint_green.png
convert grad.png -intensity average -fill "rgb(0,0,255)" -tint 30 tint_blue.png
convert grad.png -intensity average -fill "rgb(255,255,0)" -tint 30 tint_yellow.png
convert grad.png -intensity average -fill "rgb(0,255,255)" -tint 30 tint_cyan.png
convert grad.png -intensity average -fill "rgb(255,0,255)" -tint 30 tint_magenta.png
However: If I use -fx and try to simulate the tint formula (though it may not be correct), all look similar even with a normal rec709luma gradient.
fact=0.3 (hoping it corresponds to tint 30)
convert -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
\( -clone 0 \) \
-delete 0 -combine fx_red.png
convert -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
-delete 0 -combine fx_green.png
convert -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_blue.png
convert -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
-delete 0 -combine fx_yellow.png
convert -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_cyan.png
convert -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_magenta.png
The above is kind of what I expected from -tint with respect to symmetry among all the colors tested
Re: possible bug -tint 6.8.7.6 Q16 Mac OSX
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.7-7 Beta available by sometime tomorrow. Thanks.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug -tint 6.8.7.6 Q16 Mac OSX
Thanks.
I believe this is a closer implementation (though it does not seem to matter with or without the -intensity). I forgot the multiply by u
But I would be curious what the exact fx expression is that matches the corrected -tint.
fact=0.3
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
\( -clone 0 \) \
-delete 0 -combine fx_red2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
-delete 0 -combine fx_green2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_blue2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
-delete 0 -combine fx_yellow2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_cyan2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_magenta2.png
I believe this is a closer implementation (though it does not seem to matter with or without the -intensity). I forgot the multiply by u
But I would be curious what the exact fx expression is that matches the corrected -tint.
fact=0.3
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
\( -clone 0 \) \
-delete 0 -combine fx_red2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
-delete 0 -combine fx_green2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_blue2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
-delete 0 -combine fx_yellow2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_cyan2.png
convert -intensity average -size 256x256 gradient: -rotate 90 \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
\( -clone 0 \) \
\( -clone 0 -fx "u+$fact*u*(1-(4.0*((u-0.5)*(u-0.5))))" \) \
-delete 0 -combine fx_magenta2.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug -tint 6.8.7.6 Q16 Mac OSX
This seems to be fixed now in 6.8.7.7 beta.
All the test images have their color distributions the same. Thanks
All the test images have their color distributions the same. Thanks