Hi,
I have two different strange behaviours:
1.) I have a 8 bit Lab Tiff image (can be send if wanted) which i want to split into three gray images (PNG's) containing L a and b.
Here is my code:
convert myLabTiff.tif -seperate myGrayTiff.png
Results first look good but when i compare pixel values to original tiff they changed a little bit (very little, only between zero and approximately 5 gray values), why?
i also tested
convert myLabTiff.tif -colorspace LAB -seperate myGrayTiff.png
convert myLabTiff.tif -set colorspace LAB -seperate myGrayTiff.png (whats the difference to above?)
2) Whats also very interresting is my second problem:
I have a 16 bit RGB Tiff which i want to seperate inte 3 L, a and b Gray images:
convert myRGBTiff.tif -set colorspace Lab myLabPNG.png
and then i make
convert myLabPNG.png -separate myGrayPNG.png
and result is different from
convert myRGBTiff.tif -set colorspace Lab -separate myGrayPNG.png
or from
convert myRGBTiff.tif -separate -set colorspace Lab myGrayPNG.png
why, i do not understand this....
and: Isn't a whitepoint necessary to convert from RGB to Lab or is the whitepoint stored in the RGB tiff ?
Bug or feature - change of pixel values in seperate?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bug or feature - change of pixel values in seperate?
Check the verbose info (convert image -verbose info:) for each input and output image and see what the colorspace is. You are probably getting it automatically converted to RGB prior to separating it if you don't use the proper means of -set colorspace and separate and -colorspace as in my earlier post to you. Also one has to be careful as PNG only supports RGB, so you have to sort of trick the conversion so that it thinks the LAB channels are RGB without converting them.
I really don't understand all these differences and Anthony would have to explain in more detail.
I really don't understand all these differences and Anthony would have to explain in more detail.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Bug or feature - change of pixel values in seperate?
The first changes the colorspace to LAB and the image data as well. IT should produce 3 images as PNG can only save one image per file.Franz777 wrote:(whats the difference to above?)Code: Select all
convert myLabTiff.tif -colorspace LAB -seperate myGrayTiff.png convert myLabTiff.tif -set colorspace LAB -seperate myGrayTiff.png
The Second chnages the images colorspace setting, but does NOT change the image data. That makes IM think the images original images color space is LAB without change.
PNG can not save in LAB colorspace, at least not without profiles. So when the first command sets the colorspace to be LAB, (without data change), and you then save it, IM resets the colorspace to RGB, changing the data as well during the save to PNG file format. Thus the data was converted from what IM things to LAB to RGB.2) Whats also very interresting is my second problem:
I have a 16 bit RGB Tiff which i want to seperate inte 3 L, a and b Gray images:
and then i makeCode: Select all
convert myRGBTiff.tif -set colorspace Lab myLabPNG.png
Code: Select all
convert myLabPNG.png -separate myGrayPNG.png
The second simply separates the PNG channels to separate gray scale images.
You set it to LAB, seperated the channels (the original unchanged data) as grayscale (RGB) channel images.and result is different fromCode: Select all
convert myRGBTiff.tif -set colorspace Lab -separate myGrayPNG.png
As such it is the same as if you never changed the color space at all!
Now you read in the image, separate the three channels (unchanged) into Grayscale images (RGB), now you tell IM to consider those gray scale images to be LAB images (without data change) and save them into PNG (conveting LAB to RGB) essentially you get nonsense. Grayscale data pretending to be LAB (which is nonsense), converted to RGB!!!or fromCode: Select all
convert myRGBTiff.tif -separate -set colorspace Lab myGrayPNG.png
You can set 'whitepoint' and other color specification settings.why, i do not understand this....
and: Isn't a whitepoint necessary to convert from RGB to Lab or is the whitepoint stored in the RGB tiff ?
See the options: ‑black‑point‑compensation, ‑white‑point, ‑red‑primary, ‑green‑primary, ‑blue‑primary; on
http://imagemagick.org/script/command-line-options.php
However I have no idea what these settings really mean, or the result of changing the settings. I have not looked into them. I just know they are present and are used by some image file format coders (due to my current work for IMv7 CLI interface changes.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/