Please see the following thread for all the details:
viewtopic.php?f=1&t=33440
-clone converts grayscale image to sRGB
-
- Posts: 15
- Joined: 2018-01-16T19:26:03-07:00
- Authentication code: 1152
- Location: Washington D.C. area
Re: -clone converts grayscale image to sRGB
For anyone following this bug:
There have been a number of additional updates to the linked thread above which include important new information.
There have been a number of additional updates to the linked thread above which include important new information.
Re: -clone converts grayscale image to sRGB
We require a minimal command line to reproduce the problem before we will investigate further. These commands prove -clone does not affect the image colorspace:
What are the fewest command-line options you can come up with that illustrates the problem you are having. We will investigate further once we see what you come up with.
Code: Select all
convert logo: logo.pgm
convert logo.pgm -clone 0 -delete 0 logo.mpc
identify -verbose logo.mpc
head logo.mpc
...
type=Grayscale
colorspace=Gray
...
-
- Posts: 15
- Joined: 2018-01-16T19:26:03-07:00
- Authentication code: 1152
- Location: Washington D.C. area
Re: -clone converts grayscale image to sRGB
OK, try this (IM 7.0.7-22 Q16 HDRI) on Windows 10:
This fails:
Result:
This is as simple as I can make it. As explained in my last post of the above referenced thread, the problem is not with clone per se, but with how the resize and the first clone (with the gamma conversion) in the sequence above interact.
If you take out the resize, it works:
"input.tif" and "Gray-elle-V2-g10.icc" can be obtained here for testing:
https://www.dropbox.com/sh/svxba869nhqa ... lD-za?dl=0
(Edit: Fixed dropbox link)
Hope this helps.
This fails:
Code: Select all
magick input.tif -write input.icc ^
-profile Gray-elle-V2-g10.icc -distort Resize 500 ^
( -clone 0 -gamma 3 -gamma 0.33333 ) ( -clone 0 ) -delete 0 ( -clone 1 ) -compose over -composite ^
-profile input.icc output.tif
Code: Select all
magick: color profile operates on another colorspace `icc' @ error/profile.c/ProfileImage/1018.
If you take out the resize, it works:
Code: Select all
magick input.tif -write input.icc ^
-profile Gray-elle-V2-g10.icc ^
( -clone 0 -gamma 3 -gamma 0.33333 ) ( -clone 0 ) -delete 0 ( -clone 1 ) -compose over -composite ^
-profile input.icc output.tif
Code: Select all
magick identify output.tif
output.tif TIFF 600x761 600x761+0+0 16-bit Grayscale Gray 942600B 0.000u 0:00.000
https://www.dropbox.com/sh/svxba869nhqa ... lD-za?dl=0
(Edit: Fixed dropbox link)
Hope this helps.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: -clone converts grayscale image to sRGB
I have some further simpler tests that show it is related to adding -evaluate pow 0.5 in combination with -distort Resize, but works using -evaluate pow 2
This works in IM 7 -- no -evaluate pow 0.5
This fails in IM 7 -- with -evaluate pow 0.5
This works in IM 7 -- with -evaluate pow 2
This works in IM 6 -- with -evaluate pow 0.5
It also works if one takes out the -distort Resize but keep the -evaluate pow 0.5
This works in IM 7 -- no -evaluate pow 0.5
Code: Select all
magick input.tif -write input.icc \
-profile Gray-elle-V2-g10.icc -distort Resize 500 \
\( -clone 0 \) -compose over -composite \
-profile input.icc output.tif
This fails in IM 7 -- with -evaluate pow 0.5
Code: Select all
magick input.tif -write input.icc \
-profile Gray-elle-V2-g10.icc -distort Resize 500 \
\( -clone 0 -evaluate pow 0.5 \) -compose over -composite \
-profile input.icc output.tif
This works in IM 7 -- with -evaluate pow 2
Code: Select all
im7 magick input.tif -write input.icc \
-profile Gray-elle-V2-g10.icc -distort Resize 500 \
\( -clone 0 -evaluate pow 2 \) -compose over -composite \
-profile input.icc output.tif
This works in IM 6 -- with -evaluate pow 0.5
Code: Select all
convert input.tif -write input.icc \
-profile Gray-elle-V2-g10.icc -distort Resize 500 \
\( -clone 0 -evaluate pow 0.5 \) -compose over -composite \
-profile input.icc output.tif
It also works if one takes out the -distort Resize but keep the -evaluate pow 0.5
Code: Select all
magick input.tif -write input.icc \
-profile Gray-elle-V2-g10.icc \
\( -clone 0 -evaluate pow 0.5 \) -compose over -composite \
-profile input.icc output.tif
Re: -clone converts grayscale image to sRGB
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 @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.