Page 1 of 1

Convert Images to LAB

Posted: 2018-06-11T05:11:28-07:00
by tterpell
Hello,

i am completely new to Imagekick and i need to convert different types of images to the LAB colorspace.
I Am currently using this command:

Code: Select all

magick convert "input4.tif" -flatten +profile tiff:37724 -colorspace Lab -auto-orient -intent Absolute -compress LZW "output4.tif"
The problem is, that this command seems not to work for ECI-RGB images and CMYK images.
If I convert a CMYK image to LAB, the image looks completely oversaturated in magenta and cyan.
If I convert an ECI-RGB image to LAB, it is a bit darker than the original.

Help would be greatly appreciated,
Thanks

Re: Convert Images to LAB

Posted: 2018-06-11T10:35:28-07:00
by fmw42
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown

Note that for ImageMagick 7, convert is replaced by magick; otherwise, you are likely using ImageMagick 6.

Re: Convert Images to LAB

Posted: 2018-06-11T10:56:14-07:00
by fmw42
Try converting from eci-rgb to srgb with profiles. Then convert to lab with -colorspace lab. I suspect ImageMagick does not know the eci-rgb colorspace, so you cannot convert from it using -colorspace. But you could with an eci-rgb profile. See http://www.eci.org/en/downloads for profiles.

Or use profiles to go from eci-rgb directly to lab.

Can you post a link to one of your eci-rgb files?

Re: Convert Images to LAB

Posted: 2018-06-11T23:55:46-07:00
by tterpell
The Version i Use is ImageMagick 7.0.7-38 Q16 x86_64 2018-06-02.
The System i am on is macOS 10.13.5.

Using this Command

Code: Select all

magick convert in.tif -colorspace LAB -intent absolute out.tif
i get the following result (on the left is the in.tif, on the right the out.tif):
https://drive.google.com/file/d/1hJAjGN ... sp=sharing

Re: Convert Images to LAB

Posted: 2018-06-12T00:40:40-07:00
by snibgo
What software do you have that is reading and displaying Lab images? What data format does it expect? IM writes unsigned integers. Perhaps your reader software expects signed integers.

I suggest you try with ordinary photos, not images that have only three colours: black, white and some other colour.

Re: Convert Images to LAB

Posted: 2018-06-12T06:56:04-07:00
by tterpell
WEll, i made progress. I split the conversion into two steps:
At first, i converted the original image to a sRGB colorprofile using

Code: Select all

convert ECI_RGB.tif -profile Profile/sRGB2014.icc out.tif
Then, i converted the resultfile to LAB:

Code: Select all

convert out.tif -colorspace LAB lab.tif
But i needed to install Imagemagick with

Code: Select all

brew reinstall imagemagick --with-little-cms --with-little-cms2
to get that working.

The result: The image i get from the first command (out.tif) looks completely identical to the original.
When i perform the final command (to LAB), i can notice a slight shift in color. barely noticable. But it is there. Any idea how i can get rid of that?
I Noticed that the color profile that the image has that i want to convert to LAB, makes a big difference. If the image is in ECI-RGB, it is darker after i converted it. If it is in sRGB, i notice only a slight color shift. If it is in a CMYK-Profile, it looks completely different.
That leads me to the question: is there a Colorprofile that is better suited for the LAB conversion than sRGB2014?
Or is there any magical parameter that i can add to the second command to get rid of the color shift?

Re: Convert Images to LAB

Posted: 2018-06-12T09:51:08-07:00
by fmw42
If you do not start with sRGB image, then you will likely need a correct profile for the input, if there is not one attached to the input. So you may need to find an ECI_RGB profile from the page I reference and use two profiles, eci_rgb and then sRGB before you go to LAB. You may also be able to find an LAB profile and then just use the eci-rgb to lab profiles.

Re: Convert Images to LAB

Posted: 2018-06-12T19:28:41-07:00
by fmw42
Can you post a link to an example ECI_RGB image?