Page 1 of 1

convert tiff to pdf

Posted: 2015-11-18T14:56:28-07:00
by iosif aug
Hello,

I need to convert a tiff file that has Lab colorspace to a pdf file, and preserve the Lab colorspace to the output pdf.
I used :
convert fileLAB.tiff output.pdf, or
convert fileLAB.tiff -colorspace Lab output.pdf
Also I tried to use folowing code snipet into a C source:
MagickWand* mw;
MagickWandGenesis();
mw = NewMagickWand();
MagickReadImage(mw,"fileLAB.tiff");
MagickSetImageColorspace(mw, LabColorspace );
MagickWriteImage(mw,"output.pdf");
DestroyMagickWand(mw);
MagickWandTerminus();
The problem is that the output.pdf has sRGB colorspace instead of original Lab colorspace.
Does anyone have a solution for preserve Lab colorspace to the putput.pdf ?

Thank you.

Re: convert tiff to pdf

Posted: 2015-11-18T15:19:37-07:00
by snibgo
Some quick experiments using tiffimages to confirm suggests that IM always converts back to sRGB before writing the PNG.

However, tiff2png seems to preserve the Lab colorspace.

Re: convert tiff to pdf

Posted: 2015-11-19T01:00:03-07:00
by iosif aug
I tried to convert tiff with Lab colorspace to png, using IM convert command.
Seems to be the same problem. The obtained png have sRGB colorspace.

Re: convert tiff to pdf

Posted: 2015-11-19T01:03:32-07:00
by fmw42
Did you try

Code: Select all

convert image.tif -set colorspace LAB -colorspace sRGB image.png

Re: convert tiff to pdf

Posted: 2015-11-19T02:26:25-07:00
by snibgo
iosif aug wrote:The obtained png have sRGB colorspace.
As far as I know, PNG colour channels are always red, green and blue.

Re: convert tiff to pdf

Posted: 2015-11-19T15:01:49-07:00
by iosif aug
It seems that the problem is converting Lab tiff in PNG.The PNG is always RGB(sRGB).
When is converted a CMYK tiff to pdf, IM converts tiff to PAM image format, and then put this image in pdf file.
In this case(CMYK), the resulting file has same colorspace as the input file .
There is a way in IM to choose image format inside pdf?

Re: convert tiff to pdf

Posted: 2015-11-19T17:44:18-07:00
by fmw42
PNG only supports pixel data in RGB channels. It does not support LAB or CMYK channels unless you have a profile to represent the conversion to that channel type.

When you save an image to PDF, it just puts a vector shell about the raster data. I believe the raster data should be in whatever image type you used when you created the PDF. But if you want to extract the raster data from the PDF, you need to use some other tool besides IM to extract it. I think that is pdfimage.