I have a task where I need to take PDFs that are mock ups of printing products, and check their resolution, size and colour-space. I need to use Imagick with PHP to complete this task.
The printing shop that will print these PDFs only have CMYK printers and so, the uploaded PDF need to have CMYK colours. But I am not clear on how colour-spaces(CMYK/RGB) work in PDF, or in jpeg/png images. So, I have a few questions that will hopefully help me understand the thing better and complete the task:
From what I understand, we can draw objects or add images to the pdf that can have their colours defined as RGB or CMYK, but how does this affect the colour-space of the entire PDF?
Is it possible to check the colour-space of a PDF in php, without converting it jpeg/png?
If I have images in a PDF defined in either CMYK or RGB colour-space and convert the PDF to jpeg/png with Imagick, does the colour-space remain the same in the converted image unless specifically mentioned by
Imagick::transformImageColorspace()
?A short background information on how colour-spaces work, how they are defined and detected and how they are affected when the file is converted from one mime-type to another.
P.S.: I am converting the PDFs to jpeg/png and checking the colour of the converted file as below, but it always gives false
, no matter what pdf I use.
$img = new imagick(self::$_imgArray[0]);
if($img->getimagecolorspace() == imagick::COLORSPACE_CMYK)
echo "Image is in CMYK";