Page 1 of 3

PAID: PDF color profil settings

Posted: 2018-01-17T02:50:07-07:00
by DarrenPotter
Hi,

I'm looking for someone with experience of ImageMagick and PDF color profiles who can help me with some configuration.

PDFs had been coming out with undefined color profiles and we are wanting to set them to sRGB.

PM me if you can help :)

Darren

Re: PAID: PDF color profil settings

Posted: 2018-01-17T10:37:28-07:00
by fmw42
Can you post an example PDF to some free hosting service that does not change the image format (such as dropbox.com) or zip the PDF before uploading. Then put the URL here so we can see what you have.

If your input is a vector PDF, then Imagemagick will rasterize your PDF. Then if you try to save again as PDF, you will lose all vector data and have dots for every pixel.

If you are trying to convert your PDF to some other raster format, such as PNG or JPG, etc., then you can convert from CMYK either using -colorspace or with profiles.

Code: Select all

convert -colorspace sRGB -density XX  image.pdf image.png
or using profiles. If it contains a cmyk profile, then

Code: Select all

convert -density XX  image.pdf -profile path2/sRGB.icc image.png
If it does not have a profile and you know it is cmyk, then

Code: Select all

convert -density XX  image.pdf -profile path2/USWebCoatedSWOP.icc profile path2/sRGB.icc image.png
XX is the density value (such as 300) to tell the vector PDF how big to make the output raster image.

Re: PAID: PDF color profil settings

Posted: 2018-01-18T02:40:32-07:00
by DarrenPotter
Thanks for the reply! :)

I've zipped an example PDF: https://drive.google.com/file/d/1fVLfos ... sp=sharing

The document's color profile is "Device RGB". Whilst probably not a problem for black and white printing, it affects the color prints quite a lot. The image in the PDF comes from a PNG.

Our print company gave us 3 options in descending order of preference:

1) To embed an sRGB ICC profile in the image
2) Separate the image to CMYK
3) Tag the whole PDF with sRGB

Not sure which is possible/easiest. We did succeed with using CMYK in some way, but this ballooned the file size to in excess of 100MB which isn't ideal. We tried exploring downsampling but it seems that compression has been applied instead and affected the print quality.

As you can probably tell, I'm not the developer and this is a completely new area for our guy so we've been stumbling around with it.

Re: PAID: PDF color profil settings

Posted: 2018-01-18T11:43:09-07:00
by fmw42
Darren,

I am a bit confused. You first post says you want to convert to sRGB. But your second post seems to imply you want cmyk. Your PDF already is sRGB with a fully opaque alpha channel. Imagemagick sees no profile associated with the PDF. EXIFTOOL shows EmbeddedImageColorSpace: DeviceRGB, which is no the same as a profile, I do not think.

If I add an sRGB profile via

Code: Select all

convert poster-308.pdf -profile /Users/fred/images/profiles/sRGB.icc new_poster-308.pdf
Then IM still shows no profile, but EXIFTOOL shows EmbeddedImageColorSpace: ICCBased.

Is that what you want?

I would point out that EXIFTOOL shows your PDF to have:

- EmbeddedImageWidth : 8268
- EmbeddedImageHeight : 11811
- EmbeddedImageColorSpace : DeviceRGB

So the actual imbedded size is 8268x11811.

But Imagemagick says it is:

Geometry: 1984x2835+0+0
Resolution: 72x72
Print size: 27.5556x39.375
Units: Undefined


So I think your file was not created well. To show that I think it must have had a different density assigned when putting the PNG into the PDF shell, but was assigned Resolution(density) of 72 and no units.

I have extracted the PNG from the PDF and find it is 8268x11811. When I assign an sRGB.icc profile and put that back into a PDF, it ends up being 8268x11811 rather than 1984x2835. So the resulting PDF is much larger than your original. I suppose the PNG could be resized before inserting into the PDF.

Code: Select all

pdfimages -png poster-308.pdf poster_300
convert poster_300-000.png -resize 1984x2835 -profile /Users/fred/images/profiles/sRGB.icc new_poster_300_000.pdf
But the file size increases to 2.94753MiB.

EXIFTOOL shows:

- EmbeddedImageWidth : 1984
- EmbeddedImageHeight : 2834
- EmbeddedImageColorSpace : ICCBased


So it looks like the first way of just adding the sRGB.icc profile provides the ICCBased EmbeddedImageColorSpace and does not increase the filesize.

Re: PAID: PDF color profil settings

Posted: 2018-01-18T12:01:19-07:00
by snibgo
This seems like the usual problem of embedding raster images inside PDF files.

I currently can't download large files (or anything much). Does the PDF have only one image?

If so, I would extract the image with pdfimages. Then look at the image: it might by CMYK or not, with or without an embedded ICC profile.

Re: PAID: PDF color profil settings

Posted: 2018-01-18T14:20:39-07:00
by fmw42
I did that. I used pdfimages to convert to tiff and also to png. It showed sRGB. There was only one large image, but pdfimages made two images. The second was completely blank. IM sees only one page as do other PDF viewers.

Re: PAID: PDF color profil settings

Posted: 2018-01-18T14:24:43-07:00
by snibgo
DarrenPotter wrote:Our print company gave us 3 options in descending order of preference:

1) To embed an sRGB ICC profile in the image
That seems the best option. Extract the image with pdfimages, assign an sRGB profile, and send that to the print company.

Re: PAID: PDF color profil settings

Posted: 2018-01-18T15:37:15-07:00
by fmw42
snibgo wrote: 2018-01-18T14:24:43-07:00
DarrenPotter wrote:Our print company gave us 3 options in descending order of preference:

1) To embed an sRGB ICC profile in the image
That seems the best option. Extract the image with pdfimages, assign an sRGB profile, and send that to the print company.
I did that with this file and you can see that the extracted image was larger than Imagemagick thought. When I added the profile and converted to pdf, the new default file dimensions were several times larger and the file size was huge.

Re: PAID: PDF color profil settings

Posted: 2018-01-19T03:32:33-07:00
by snibgo
fmw42 wrote:When I added the profile and converted to pdf ...
Why convert it to PDF? I can't see the point in doing that.

Re: PAID: PDF color profil settings

Posted: 2018-01-19T06:20:19-07:00
by DarrenPotter
Fred,

I'm probably mixing terminology. I'm sitting in the middle of a print expert and a developer and have little knowledge of either areas myself so please bear with me :lol:
You first post says you want to convert to sRGB. But your second post seems to imply you want cmyk. Your PDF already is sRGB with a fully opaque alpha channel. Imagemagick sees no profile associated with the PDF. EXIFTOOL shows EmbeddedImageColorSpace: DeviceRGB, which is no the same as a profile, I do not think.
Sorry if I was unclear. It is sRGB we want as it is our printing company's "standard". We tested CMYK as we didn't seem to be able to make progress with getting sRGB sorted in the correct way. We're having some quality issues with the CMYK version though so I want to go back to the preferred sRGB and resolve that successfully.

When I sent the PDF that I shared here to the printing company they sent this image back to me and said that the image appears as RGB but doesn't state which:

Image

The original image (which can be found here: https://drive.google.com/file/d/1SN4SVg ... sp=sharing). As you correctly observed, the image is 8268x11811. The original image also has sRGB color space. From what I understand, this information hasn't been retained when the PDF is created.

The original image is 72dpi and a lot larger than required. Resizing it gives us a higher resolution and a better quality when printed.

Does this help clarify things?

Re: PAID: PDF color profil settings

Posted: 2018-01-19T06:59:11-07:00
by snibgo
Why is in in a PDF? Is that a requirement?

PDF is a wrapper around a raster image, and it make life complicated because the PDF has a resolution and a colourspace, and these may be different to the embedded image.

When I send images to be printed, I never put them in PDFs. There is no need.

Re: PAID: PDF color profil settings

Posted: 2018-01-19T07:28:37-07:00
by DarrenPotter
I suppose the thinking is that using a PDF wrapper allows us to define the document size and resolution required. The image is 72dpi and as large as it is to allow us to scale it down to the actual size and resolution needed. In this case 700 x 1,000mm and 300 dpi, though the document size can vary. Is there another way to do this?

Re: PAID: PDF color profil settings

Posted: 2018-01-19T07:51:02-07:00
by snibgo
Internet problems prevent me from downloading the PDF.

But I suppose it contains a single raster image, and that image contains a resolution (pixels per inch) and hence a physical size. It may also contain an embedded profile.

Sure, you can wrap that in a PDF, which itself contains some other resolution and some other colorspace. But that's an extra layer of confusion. You have two sets of settings: one for the image, and one for the wrapping PDF.

Re: PAID: PDF color profil settings

Posted: 2018-01-19T10:26:14-07:00
by fmw42
As snibgo has said, you would be better extracting the image from the PDF and resizing to the pixel size you want and assign the density you want for printing as well as the color profile. Then not putting that result back into a PDF shell.

This would be something like:
pdfimages -png image.pdf new image
convert newimage-000.png -resize WxH -units pixelsperinch -density XX -profile path2/sRGB.icc newimage.png
where WxH is your desired pixel dimensions and XX is your desired density (resolution) in dotsperinch such that when you multiply the two you get your desired print size in inches.

pdfimages is a separate tool from Imagemagick

Re: PAID: PDF color profil settings

Posted: 2018-01-22T01:26:43-07:00
by DarrenPotter
Thanks for the input guys.
As snibgo has said, you would be better extracting the image from the PDF and resizing to the pixel size you want and assign the density you want for printing as well as the color profile. Then not putting that result back into a PDF shell.
This is interesting. I'm checking with the printing company to see if they are ok with us just sending an image. I imagine the answer will depend on whether it creates more work for them or not. If not, then this is definitely the way to go. Fortunately the original PNGs are created on the server so we don't need to extract them from the PDF.