Page 1 of 1

Preserving Color Profile for Renditions

Posted: 2016-12-31T13:22:59-07:00
by ChristianJP
Hello,

I am working on an IM script. The intent is to auto populate renditions from master files (incl. .TIF, .PSD, .JPG). One rendition is to generate CMYK. I've successfully created the various renditions using this script:

@echo off

set ORIGINAL_FOLDER=.\original-assets
set RENDITION_FOLDER=.\renditions

for /f %%A in ('dir /B %ORIGINAL_FOLDER%') DO (
echo Generating Renditions for %%A...
::* Generate 300 dpi CMYK Rendition
convert %ORIGINAL_FOLDER%/%%A -define jpeg -density 300 -colorspace CMYK -gravity center %RENDITION_FOLDER%/300CMYK/%%A_300CMYK.jpg

::* Generate 300 dpi RGB Rendition
convert %ORIGINAL_FOLDER%/%%A -define jpeg -density 300 -colorspace RGB -gravity center %RENDITION_FOLDER%/300RGB/%%A_300RGB.jpg

::* Generate 150 dpi RGB Rendition
convert %ORIGINAL_FOLDER%/%%A -define jpeg -density 150 -colorspace RGB -gravity center %RENDITION_FOLDER%/150/%%A_150.jpg

::* Generate 72 dpi Rendition
convert %ORIGINAL_FOLDER%/%%A -define jpeg -density 72 -colorspace RGB -gravity center %RENDITION_FOLDER%/72/%%A_72.jpg
)

HOWEVER, the resulting color is off.
In Photoshop, for example, when I save the .PSD as a .JPG, I make the following choices:
Include Layers
Embed Color Profile: US Sheetfed Coated v2
No Compression
Interleaved Pixel Order
Layer Compression: RLE

How do I get the correct color profile in my resulting renditions?

I've tried adding: -profile USSheetfedCoasted.icc , but did not specify a profile path. this did not work.

I also tried adding -profile sRGB just after the -define, then -colorspace sRGB - strip at the end. this did not work.

This is a command line script which will be run by an enterprise program when finalized.

Thank you!

Re: Preserving Color Profile for Renditions

Posted: 2016-12-31T13:37:56-07:00
by fmw42
You have to supply the full path to your selected profile, which must be on your system. The -profile ... should be added just before writing the output image, presumably already CMYK. Or better, take your RGB image make sure (or add) -profile path2/sRGB.icc -profile path2/USWebCoatedSWOP.icc to convert your RGB image to CMYK (without using -colorspace CMYK). The latter is the proper way.

Why do you need -define jpeg? Your output suffix of .jpg is enough. In fact, I do not know that there is a -define jpeg command!

You should probably add -units pixelsperinch to be sure the density has a proper units associated with it and not undefined.

Re: Preserving Color Profile for Renditions

Posted: 2016-12-31T14:12:35-07:00
by snibgo
Please say what version IM you are using.
ChristianJP wrote:-colorspace RGB
I suspect you wanted "-colorspace sRGB", so this is one source of your colour problems.

Conversion between sRGB and CMYK should generally be done with "-profile", not "-colorspace".

You need to provide the path to your profile files, if they are not in the current directory.