Page 1 of 1

CMYK TIFF to LAB TIFF convertion

Posted: 2011-11-24T03:41:13-07:00
by citydavid
How can I convert a cmyk tiff file to lab tiff, using embedded profiles? Can I manage unknow or absent profiles?
I try: convert -verbose "input_CMYK.tif" -profile "USWebCoatedSWOP.icc" -colorspace LAB "out_LAB.tif", but color convertion is not good.
Regards,
David

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2011-11-26T13:15:40-07:00
by fmw42
try converting to RGB or sRGB before changing colorspace

convert -verbose "input_CMYK.tif" -profile "USWebCoatedSWOP.icc" -profile "AdobeRGB1998.icc" -colorspace LAB "out_LAB.tif

or

convert -verbose "input_CMYK.tif" -profile "USWebCoatedSWOP.icc" -profile "sRGB.icc" -colorspace LAB "out_LAB.tif

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-04-29T03:50:42-07:00
by rubenedoc
Hi guys,

I´m brand new in ImageMagick, so maybe I loosing something, but I still cannot be able to convert correctly a CMYK tif file into a LAB tif file.
Let me explain my case:
1- I receive a CMYK image (1x1), with C = 0, M = 100%, Y = 100%, K = 0 (its LAB is "cielab(53.2311%,80.708%,74.3816%)")
2- I have an icc profile "myProfile.icc"
3- I´m told that after passing that image through "myProfile.icc" profile, the LAB color of the result should be "L=53,8%; a=44,8%; b=26,0%"
4- The command I´m using is the following:

Code: Select all

convert -verbose myCMYKImage.tif -profile myProfile.icc  myLABimage.tif
When I run

Code: Select all

convert myLABimage.tif[1x1+0+0] -colorspace LAB -format "%[pixel: u.p{0,0}]" info:
I get the same LAB values than the original image: "cielab(53.2311%,80.708%,74.3816%)"

What am I doing wrong? Is it not the correct "convert" using? Is there any way to check if the icc profile is correct?

Any help would be appreciated.

Thank you very much in advance.

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-04-29T06:58:19-07:00
by snibgo
rubenedoc wrote:I´m told that after passing that image through "myProfile.icc" profile
What does "passing through" mean?

IM, like other tools, allows you to do two things with profiles on images: apply the profile or convert to the profile. If the image has no profile, "-profile x.icc" applies it. If it already has a profile applied, "-profile x.icc" will convert to the new profile.

Applying means the profile is embedded in the image file, but pixels values are not converted. Converting means the embedded profile is replaced, and pixel values are converted.

If a file has no profile, the first "-profile" will apply, and the second will convert.

I think you want to convert pixel values for the file myCMYKImage.tif which has no profile. So you need to apply a suitable CMYK profile, then convert to another profile, eg:

Code: Select all

convert -verbose myCMYKImage.tif -profile USWebCoatedSWOP.icc -profile myProfile.icc  myLABimage.tif

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-04-30T03:47:25-07:00
by rubenedoc
Thanks for your fast reply, Snibgo.

Yes, you are right, I want to convert to "myProfile.icc".
The original image "myCMYKimage.tif" has no profile.

I did exactly what you say (applying USWebCoatedSWOP.icc and then converting to myProfile.icc):

Code: Select all

convert -verbose myCMYKImage.tif -profile USWebCoatedSWOP.icc -profile myProfile.icc  myLABimage.tif
but doing these changes

Code: Select all

convert -verbose /myPath/myCMYKImage.tif -profile /myPath/USWebCoatedSWOP.icc -profile /myPath/ISOnewspaper26v4.icc /myPath/myLABimage.tif
Before executing this command, I do:

Code: Select all

convert /myPath/myCMYKImage.tif[1x1+0+0] -colorspace LAB -format "%[pixel: u.p{0,0}]" info:
convert /myPath/myCMYKImage.tif[1x1+0+0] -colorspace CMYK -format "%[pixel: u.p{0,0}]" info:
to get CMYK and LAB color information. The results are "cmyk(0,255,255,0)" (this is correct, 100% magenta and 100% yellow, the rest 0%) and "cielab(136,206,190)", respectively.

After executing the command, I do:

Code: Select all

convert /myPath/myLABimage.tif[1x1+0+0] -colorspace LAB -format "%[pixel: u.p{0,0}]" info:
convert /myPath/myLABimage.tif[1x1+0+0] -colorspace CMYK -format "%[pixel: u.p{0,0}]" info:
and I get exactly the same color information in CMYK and LAB colorspaces.

It seems it does not convert, or maybe I don´t get correctly the color information.

Thank you very much in advance.

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-04-30T04:10:11-07:00
by snibgo
Why do you think it isn't converting?

You take a pixel, and convert it to LAB and CMYK and observe the values.

You take the same pixel, convert it to some other colorspace, and convert that to LAB and CMYK. You observe the same values.

It's like converting inches to centimeters directly, or going via a conversion to miles. The end result should be the same.

If you want to see the numeric values in the pixel, you could try ...

Code: Select all

convert /myPath/myLABimage.tif[1x1+0+0] txt:
... and I would expect to see different numbers before and after the profile conversion. However, those different numbers represent the same colour.

Re-reading your post:
3- I´m told that after passing that image through "myProfile.icc" profile, the LAB color of the result should be [something different].
Well, that's not what profiles are intended to do. However, if you convert to a new profile and then delete that profile (with "+profile" or "-strip"), the file will appear to be in sRGB colorspace, although the pixels values won't be changed.

Perhaps this is what your informant meant by "passing the image through a profile".

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-04-30T04:41:21-07:00
by rubenedoc
Thank you very much again for your fast reply, Snibgo.

Well, when I say "passing through" the icc profile, I mean "converting".

I did what you say:

Code: Select all

convert /myPath/myCMYKImage.tif[1x1+0+0] txt:
before applying USWebCoatedSWOP.icc and then converting to myProfile.icc and the result is
"# ImageMagick pixel enumeration: 1,1,255,cmyk
0,0: ( 0,255,255, 0) #00FFFF00 cmyk(0,255,255,0)"
and for cielab:
"# ImageMagick pixel enumeration: 1,1,255,cielab
0,0: (136, 78, 62) #884E3E cielab(136,78,62)"

Then I did the same for the resulting image:

Code: Select all

convert /myPath/myLABImage.tif[1x1+0+0] txt:
and the result is exactly the same:
"# ImageMagick pixel enumeration: 1,1,255,cmyk
0,0: ( 0,255,255, 0) #00FFFF00 cmyk(0,255,255,0)"
and for cielab:
"# ImageMagick pixel enumeration: 1,1,255,cielab
0,0: (136, 78, 62) #884E3E cielab(136,78,62)"

It the conversion has been carried out, how can check it has been done correctly?

If I´m not wrong, ICC profile works (more or less) like a look up table, right? Just like this (sorry if the formatting is not correct):
ID CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z LAB_L LAB_A LAB_B
657 0 100 100 0 31.88 21.81 8.66 53.82 44.81 26.04 -> this is the real info for myProfile.icc

So if my "input" values are CMYK(0%, 100%, 100%, 0%), the output LAB values should be (53.82, 44.81, and 26.04), right?
Sorry if I´m loosing something, as I told I´m new in ImageMagick and printing world.

Thank you very much in advance.

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-04-30T05:31:18-07:00
by snibgo
Profiles have two type of components: matrices and lookup tables. You can examine the contents with various tools.

What version IM are you using? I'm on 6.8.5 under Windows 7.

I don't know what your profile does, or is supposed to do. You are trying it out on a fully-saturated pixel; if the profile tries to make it more saturated, it won't work. Perhaps your file already has a profile, which would confuse things.

You might try:

Code: Select all

convert xc:rgb(0,255,255) -set colorspace CMYK -depth 8 c.tiff
convert c.tiff txt:
convert c.tiff -profile USWebUncoated.icc txt:
convert c.tiff -profile USWebUncoated.icc -profile myProfile.icc txt:
You probably won't see a change after uswebuncoated, but might after both uswebuncoated and myProfile. If you see no change after myProfile (we are still in CMYK space, I suppose) then converting to CIELab won't see a change either.

When I try this with one of my own profiles (snibgoGBR.icc), I see no change after uswebuncoated, but do after both that and snibgoGBR.

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-05-02T03:11:48-07:00
by rubenedoc
Hello guys.

First of all, thank you for your fast replys, Snibgo.

I did what you said in your last post (create an 1x1 image, applying USWebUncoated.icc and then converting to myProfile.icc). And you are right, I see changes inc CMYK colorspace values in the new image after USWebUncoated and myProfile.
After that, I did:

Code: Select all

convert c.tiff -colorspace LAB txt:
in order to get LAB values, and it returned the following values:
"# ImageMagick pixel enumeration: 1,1,255,cielab
0,0: (136, 78, 62) #884E3E cielab(136,78,62)"
Those values are in range [0, 255]. Tranforming to percentages they are Lab(53.3%; 30.6%; 24.13%)
Those are not the expected cielab values if using myProfile.icc.
Actually, myProfile is ISOnewspaper26v4.icc, that can be found in the web. This profile says that, for CMYK(0%, 100%, 100%, 0%) values, the LAB values should be Lab(53.8%; 44.8%; 26.0%).
Maybe I don´t know how really icc profiles work, but, if an image has applied, for example, this ISOnewspaper26v4.icc profile, should the lab values for CMYK(0%, 100%, 100%, 0%) be Lab(53.8%; 44.8%; 26.0%) as profile says?

Thank you very much in advance.

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-05-03T00:07:59-07:00
by rubenedoc
Hi again.

Sorry, I forgot to mention that the CMYK values before converting to myProfile.icc(ISOnewspaper26v4.icc) are:
"# ImageMagick pixel enumeration: 1,1,255,cmyk
0,0: ( 3,253,178, 12) #03FDB20C cmyk(0, 255,255,0)".

CMYK values after converting to myProfile.icc are:
"# ImageMagick pixel enumeration: 1,1,255,cmyk
0,0: ( 3,253,178, 12) #03FDB20C cmyk(3,253,178,12)"

It seems to be a deep change in Y color...

Thank you very much for your help.

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-05-03T00:25:55-07:00
by snibgo
snibgo wrote:What version IM are you using? I'm on 6.8.5 under Windows 7.

Re: CMYK TIFF to LAB TIFF convertion

Posted: 2013-05-03T01:20:27-07:00
by rubenedoc
Sorry again!

Version: ImageMagick 6.8.4-10 for Linux