[SOLVED] RGB JPG to CMYK TIF, then combined into PDF

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mhulse
Posts: 61
Joined: 2016-03-17T18:46:22-07:00
Authentication code: 1151

[SOLVED] RGB JPG to CMYK TIF, then combined into PDF

Post by mhulse »

Hello,

I am having some issues with RGB JPG to CMYK TIF conversion.

I'm using ImageMagick though Node GraphicsMagick.

I have a folder of JPGs, and I want to convert those to CMYK TIF (optimally, with JPEG compression):

Code: Select all

....
.crop(crop.width, crop.height, crop.x, crop.y)
.resize(settings.targetWidth, settings.targetHeight)
.autoOrient()
.density(300, 300)
.units('PixelsPerInch')
.strip()
.colorspace('cmyk')
.compress('JPEG')
.quality(80)
.bitdepth(8)
.write(dest + file + '.tif', function(error) { ....
The above appears to work. When I open any of the converted images in Photoshop, everything seemingly checks out (resolution 300, CMYK, tif, etc.)

When I convert those tifs to a PDF, I get a random collection of image data that's randomly cropped and spread across the origins of the pages:

Image

The command I'm using to convert the tifs to PDF is:

Code: Select all

....
.command('convert')
.in('./tests/output/*.tif')
.stream('pdf', function(err, stdout, stderr) { ....
My question:

What do you think is the cause of the odd PDF creation? Am I overlooking any steps? What would you recommend in terms of the conversion process? my goal is to make a print-ready PDF.

I probably should mention that I am able to create a normal PDF if I don't convert the original images to TIF.

Thanks!
Last edited by mhulse on 2016-09-05T02:30:12-07:00, edited 1 time in total.
Homebrew-installed ImageMagick 7.0.8-27 Q16 x86_64 2019-02-12 | macOS Mojave | MacBook Pro
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: RGB JPG to CMYK TIF, then combined into PDF

Post by fmw42 »

I am confused. You said GraphicsMagick. This is Imagemagick, which is different from GraphicsMagick. Perhaps you should post to a GraphicsMagick forum

A guess is that you likely need to disable the crop geometry virtual canvas. In Imagemagick it would be +repage. I do not know the equivalent in GraphicsMagick.
mhulse
Posts: 61
Joined: 2016-03-17T18:46:22-07:00
Authentication code: 1151

Re: RGB JPG to CMYK TIF, then combined into PDF

Post by mhulse »

Ah, thanks so much for the reply fmw42! I really appreciate the help!

In node's version of graphicsmagick, there's an option to subclass imagemagick:

https://github.com/aheckmann/gm#use-ima ... tead-of-gm

But you're probably right on the forum thing. :)

With that said, thanks for the tip on +repage! I will look into how that works with nodeGM's IM implementation.

Quick general question about RGB to CMYK for print:

So, my main goal is to make a print-friendly PDF.

Using IM (via GM), I am able to convert the original JPG files into CMYK. When I open them in Photoshop, the colorspace is CMYK, 300 ppi, at the proper cropped dimensions.

This makes me wonder, do I really need to convert them to TIF format?

I always thought JPG was RGB only. Apparently, if I don't convert to TIF, and just maintain JPG format, then my PDF combines (via IM/nodeGM) without any issues.

Honestly, TIF makes the files unnecessarily huge. I honestly don't need all that additional file size and I am not concerned about JPG compression per se.

Stupid question, but can I just keep JPG as the file type and just make them CMYK colorspace?
Homebrew-installed ImageMagick 7.0.8-27 Q16 x86_64 2019-02-12 | macOS Mojave | MacBook Pro
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: RGB JPG to CMYK TIF, then combined into PDF

Post by fmw42 »

JPG and TIFF both support CMYK. (PNG does not.) I am not sure what you are asking. But you can convert an sRGB JPG to a CMYK JPG. You can just use -colorspace CMYK in Imagemagick. The best way would be to use profiles (for the best color accuracy).

P.S. Your original commands do not look like IM syntax. So if you are indeed using IM and not GraphicsMagick via your nodeGM, then I would not know how to tell you about +repage or how to do colorspace changes.

Seems to me that if you are using IM via GraphicsMagick via nodeGM, then you have lots of potential for issues. I would recommend skipping all that GraphicsMagick stuff and just use IM directly. But I do not know what is involved with all your interface software nor GraphicsMagick.
mhulse
Posts: 61
Joined: 2016-03-17T18:46:22-07:00
Authentication code: 1151

Re: RGB JPG to CMYK TIF, then combined into PDF

Post by mhulse »

Thank you so much for your help fmw42!!! I really appreciate it!

Excellent advice. You are right about using IM directly. I think that's going to clear up some confusion for me whilst I develop my code.

Thanks again, you have been extremely helpful. :)
Homebrew-installed ImageMagick 7.0.8-27 Q16 x86_64 2019-02-12 | macOS Mojave | MacBook Pro
Post Reply