Hi guys. I was just wondering if there is an easy way to tell if a supplied print ready pdf is in either CMYK or RGB. Is there an add on you can get or a pdf reader that will display this.
I have been looking for a way to do this in PHP as part of my form validation script. I understand from some things I have read that I'd have to pull objects out of the PDF and test them individually, but I haven't figured out how to access the objects.
you can certainly embed RGB objects in an otherwise CMYK document. I'm NOT an expert on PDF file structure, but from what I understand it's a Document Type, like lets say.....HTML. It doesn't have a switch saying either CMYK or RGB, any images or files you insert into it can EACH have their own colour profiles and colour modes, and when you save a PDF, you can force a conversion if you want. Remember, PDF is also larger than just CMYK or RGB, you can also do hexachrome, or any custom inks you wish, CMYK+spot colours. I don't know, short of actually running the file (as suggested before) you can determine what it contains. I think an important question for us to help answer you is: Why does it matter whether a PDF is RGB or CMYK for what you're trying to do?
Sorry if I am hijacking a thread, but I think it was abandoned anyway. We want to allow orders for print work to be accepted by an online shopping cart. The print house requires all artwork to be submitted in CMYK. Right now, I have set it to only allow JPG and PSD files to be uploaded because I can check their color modes as part of my server-side form validation. Some people might want to upload a PDF, and I'd like to allow it if I could check the color modes of the objects inside it.
how do you make sure the JPG's you get are CMYK? In fact, is there such a thing as a real CMYK JPG? isn't that totally contrary to the entire purpose of the specification to begin with? I would accept the PDF's, and you might have to preflight them yourself, but then if there are errors, either fix it, or send it back to them. I'd just put a warning on it sayingsomething like: any files NOT CMYK when recieved will be converted by us and we're no liable for any colour matching isues that may result. Any files as CYMK will remain untouched and sent to print. It's a tricky issue, but I think it's harder to try to prevent the issue with code than to just deal with it using human power.
Yes, there is such a thing as a real CMYK JPG. Adobe PS makes them, and I am sure there are loads of other programs that do too. Here's my "is_cmyk" function. function is_cmyk($filename) // currently only works for jpg and psd. psd requires classPhpPsdReader.php by Tim de Koning { $matches=split('\.',$filename); foreach ($matches as $key=>$value) { $extension=$value; //if there is more than one period, this will find the actual extension. } switch ($extension) { case 'psd': include('classPhpPsdReader.php'); $psd = new PhpPsdReader($filename); if($psd->infoArray['colorMode']==4) { return TRUE; } break; case 'jpg': $size = getimagesize($filename); //echo ("get image size found $size[channels] channels"); if($size[channels]==4) { return TRUE; } default: return FALSE; break; } return FALSE; } PHP:
there is such thing as a CMYK jpeg, but there can't be according to the JPEG scpeficiations - it's a hack, and although a common hack, not a widely supported hack. files like TIFF actually can be CMYK legitimately, and for print you want the best quality possible.....why you'd save an image in CMYK for print, but in low quality like JPEG is beyond me - it makes no sense!
If our artist makes the artwork, we submit it in PSD, but we accept 300dpi jpgs as well. At that resolution, there generally isn't any visable loss on the print work. I'm no expert on the specifications of JPEG, but I know it works. Back to my question though. Does anyone know how, in php, to get details about images imbedded in a pdf?
If you are preparing documents solely for the web, then for the same number of image samples RGB is negligibly faster with possibly smaller file size. If you are preparing documents for print, then CMYK is better since it preserves spot colors, and separating RGB may be unsatisfying or not possible. If you are preparing documents for both web and print CMYK is the better choice. There are cases though where you can’t always choose CMYK. Many PDF documents originally created using Microsoft or other PC applications will arrive in your shop as RGB. But there is no practical way to tell the unless you import into latest photoshop version and see the image for yourself or send it to printer.