PSD Conversion

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?".
briandenks
Posts: 29
Joined: 2013-06-19T01:35:25-07:00
Authentication code: 6789

PSD Conversion

Post by briandenks »

Hi All,

i've scoured these boards and staved off asking a question before exhausting and trying to understand my issue thoroughly.
Would appreciate ANY help i could with this question ...

OS VERSION : ubuntu 12.04 Server
IM Version and details :
Features OpenMP
LIBS -lMagickCore -llcms -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl
NAME ImageMagick
PCFLAGS -fopenmp
PREFIX /usr
QuantumDepth 16
RELEASE_DATE 2012-08-17
SHARE_PATH /usr/share/ImageMagick-6.6.9
SVN_REVISION 4345
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR unknown
VERSION 6.6.9



our issue is that we are a print shop working primarily in cmyk
we are trying to use imagemagick to convert PSD's to jpg,gif,tif, png @ 300 dpi
Our issue is that we dont use or assign a colour space for the files we work in as this makes things easier for the printers to adjust then assign there own specific profiles before print.

PSD when viewed in PSHOP has "unassigned cmyk 8bpc" pre conversion ...

CMYK PSD converted using -background white -flatten +profiles "*" -colorspace sRGB

Our problem is that ALL the file formats created from this conversion are too bright they just dont look anythign like the original psd …
We tried flipping the sRGB to RGB and the outputs became too dark …
Is there anyway to tell imagemagick to convert PSD to as best match as possible ?

This also happens with RGB PSD's the colour is just way off …
I tried using -strip -profile USWebCoatedSWOP.icc -profile sRGB.icc
i tired using -set colorspace CMYK -combine -colorspace CMYK

Really want to achieve a file that is relative in colour not way to bright not way to dark, is this possible to tell imagemagick to just convert with no additions of brightness or darkness !

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PSD Conversion

Post by snibgo »

I don't use PS, so my advice is limited.

1. You are stripping any profiles in the file. If it contains a "non-standard" (whatever that is) CYMK profile, this loses information. If the file contains a profile, it would be better to ...

Code: Select all

convert infile -profile sRGB.icc -background White -flatten out.png
... where sRGB.icc is in your current directory. It is part of the current IM package.

2. Your version of ImageMagick is rather old. An upgrade might help.
snibgo's IM pages: im.snibgo.com

briandenks
Posts: 29
Joined: 2013-06-19T01:35:25-07:00
Authentication code: 6789

Re: PSD Conversion

Post by briandenks »

Thanks for your reply snibgo, appreciate your time and advice.
Its still the same when viewed in firefox/chrome/safari ( although safari is closer in colour)
Is there a way of getting IM to debug log any actions taken ? Im on ubuntu server so no gui but more than comfy with cli.
The jpg / png / tiff / gif converted and brought back into PSHOP comes back showing brightness side by side with the original pshop file.

Is it possible to push your own .icc profiles into IM ? If so where can i place a profile for it to use ...Perhaps a better profile will produce closer result to the original pshop image...
Im sure half the problem is that no .icc profile is assigned to the PSD initially, but without seeing what IM does to the jpg ( bar basic info through metadata) i cannot see if or whats being applied..
As its ubuntu server i use apt-get to roll my updates, this is the latest version for that OS according to ubuntu, im not sure if the latest IM has more problems than what ive currently got ...
What version do you use ? Is there better libraries perhaps im not getting the fullest out of it ... Realising there really is so little i know about the sacred art of all things colour !

User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: PSD Conversion

Post by GreenKoopa »

briandenks wrote:Is it possible to push your own .icc profiles into IM ? If so where can i place a profile for it to use
-profile is used to convert an image to a new color profile (or assign it if there is none). -set profile will add the profile without conversion. Profiles can also be removed or extracted. IM comes with a few profiles, so maybe you can place yours there. You can also place them in the current directory or specify their full path.
briandenks wrote:Is there a way of getting IM to debug log any actions taken ?
I have seen -log -debug in the list of commands. Also -verbose. I output a histogram or mean/std dev/min/max for each channel to see what happened in a quantitative way.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PSD Conversion

Post by snibgo »

IM has a "-debug" option, though that doesn't trace all the operations. See http://www.imagemagick.org/script/comma ... .php#debug . Also, as GreenKoopa says, "-verbose" and "-log".

By default, IM doesn't convert to any profile nor (I think) does it use any profiles already embedded in the file. A common technique is to convert an image to sRGB.icc then, if you wish, "+profile" to remove the profile. There is no standard place for them; any directory of your choice, which you specify on the command line (eg "/profiles/sRGB.icc").

Have you tried sRGB.icc? If you convert an image with embedded profile to another profile, and view them in PS or any viewer that takes regard of profiles, they should look identical provided all the colours are in the gamut of each profile. However, CMYK and RGB gamuts in general are different. The "-intent" setting determines how colours are tweaked to handle out-of-gamut colours.

Other sRGB profiles are available, but the differences shouldn't amount to an obvious change in tone. Some browsers ignore profiles, they are unreliable indicators. See viewtopic.php?f=1&t=23446&p=98673#p98673

Ah, Ubuntu, yes, I've frequently remarked on their ancient version of IM. I don't know why they do this. Perhaps some other package requires that ancient version. What do I use? Some of my production scripts still use v6.7.9, but I'm converting them to 6.8.5 and test against the latest IM, which is currently 6.8.6. I develop new scripts under the latest version, mostly because they keep adding wonderful new features (sometimes at my request).
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD Conversion

Post by fmw42 »

If you do not imbed a profile, different browers may view the files differently. I have seen this for PNG, for example, testing with Safari, Opera, Chrome and Firefox (on my Mac OSX).

Also you should be sure you know what Photoshop is doing with colorspace and profiles. Be sure to open the Color Settings panel and make sure you know what is set there. Also PS uses Dot Gain, which IM does not understand.

You might post a link to an example PSD image (and your conversions) so that others can test conversion to other formats.

It may also be that there is a bug in 6.6.9.x. I have found some testing for a client on 6.6.9.7. I am currently using 6.8.6.0 and try to keep up with the current version but I have some old versions for testing. The only 6.6.9 version I have on my computer is 6.6.9.10 hdri.

briandenks
Posts: 29
Joined: 2013-06-19T01:35:25-07:00
Authentication code: 6789

Re: PSD Conversion

Post by briandenks »

Thanks Guys, this is really great advice here.
Have learnt more about colour space and profiles in the past week than the fist 30 odd years of my life.
Yes there is some 20% dot gain set on pshop ( i think thats a default) so i guess that theres a few things of note for this to work:
upgrade the version : theres no new deb pkg but im sure i can compile ok (any advice on stable version number for ubuntu ?)
if a psd coming in to IM doesnt have a profile i should set one and remove it after conversion ? We dont want an icc profile mismatch or error on the jpg's ideally.
We dont add any icc profile on our files but we do have a calibrated working space (colour space if you will) in pshop this is where dot gain is adjusted and LCD monitor is calibrated to match.
Any idea on where i can upload a picture of before and after ?
thanks all for your time this is really very helpful

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: PSD Conversion

Post by snibgo »

briandenks wrote:Yes there is some 20% dot gain set on pshop ...
Ah, yes, I had forgotten about dot gain in PS. If you are not using PS for everything, I suggest you turn dot gain off (but I don't use PS, so you should probably ignore me).
briandenks wrote:if a psd coming in to IM doesnt have a profile i should set one and remove it after conversion ?
I suggest that you don't use profiles unless you need to. If the PS file has no profile, I can see little point in adding one then removing it.
briandenks wrote:Any idea on where i can upload a picture of before and after ?
I use dropbox.com, but other free hosters are available (and may be more convenient).
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD Conversion

Post by fmw42 »

I suggest that you don't use profiles unless you need to. If the PS file has no profile, I can see little point in adding one then removing it.
I have found that if there is no profile, different viewers (browsers) will display different looking results at least for some png files that have been provided to me from PS.

briandenks
Posts: 29
Joined: 2013-06-19T01:35:25-07:00
Authentication code: 6789

Re: PSD Conversion

Post by briandenks »

im still none the wiser here guys !
If we are using a CMYK colour space with no .icc profile in PSHOP, we push the psd to IM and convert it to a png + jpg + tiff + gif and all the images display the same bright colour.
IM command is >>>> +profiles "*" -background white -flatten
We're trying to get a match but it just appears that IM is either missing parameters to do its job well or it cannot do an exact match. Stumped!
The issue isnt just the browser displaying the images brigher, it also comes into photoshop alot brighter, so if we did the same again and sent the image back to IM it would get brighter still until you would have an image that is too bright to see ..
Any more advice would be awesome !

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD Conversion

Post by fmw42 »

post your images to some free image hosting service (such as drop box, but there are many others). Then put links here to each image.

When you import the images from IM back to PS, do you have the Color Settings panel set so that you can choose how you want to import. Otherwise, PS may include profiles or other such things as well as dot gain (that IM does not understand).

briandenks
Posts: 29
Joined: 2013-06-19T01:35:25-07:00
Authentication code: 6789

Re: PSD Conversion

Post by briandenks »

Thanks fmw,
When you bring an cmyk IM converted jpg or png back into PSHOP complains about not knowing the icc profile ! although we dont assign one prior to sending to IM ... curious... but perhaps our +profile "*" command is telling it to add one even if there isn't one ?

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD Conversion

Post by fmw42 »

briandenks wrote:Thanks fmw,
When you bring an cmyk IM converted jpg or png back into PSHOP complains about not knowing the icc profile ! although we dont assign one prior to sending to IM ... curious... but perhaps our +profile "*" command is telling it to add one even if there isn't one ?
In IM +profile should get rid of any profile. You get that message from PS, because it wants to assign a profile. This is all set up in the Color settings window. You can set it up to prompt you and you then have an option to leave as is without any profiles (see color management policies and the check boxes at the bottom). Also check the advanced controls in the window to be sure you do not have enabled display controls to desaturate or apply gamma other than 1.

P.S. I do not believe that PNG supports CMYK. Also it is not a good idea to do processing in CMYK in IM. Most tools assume an RGB color space. You might be better to convert to RGB.

It would be best for any further discussion to have some examples of your problem. It is really hard to know what is going on without seeing your images and being able to review the meta data.

briandenks
Posts: 29
Joined: 2013-06-19T01:35:25-07:00
Authentication code: 6789

Re: PSD Conversion

Post by briandenks »

Is there anyway with IM to have it assign an icc profile if one isnt present ?
IE i have an untagged cmyk psd file and i send it to IM it sees that there is NO icc and will assign one, alternatively if there IS a profile assigned it will honour it or keep it on convert ...
Something AKIN to this >>
convert rgb.jpg +profile "*" -profile "path/to/rgb.icc" -profile "path/to/cmyk.icc" -strip -sampling-factor 1x1 -quality 95 -compress JPEG

our problem is that when we convert we're changing everything to -colorspace sRGB which is great for RGB psd's but presents an issue with a CMYK psd conversion ...
can image magick be scripted/told Hey if this file is declaring an .icc profile KEEP it but if its not please ADD this .icc profile ... im just wondering on the syntax of the above example ... First we tell it to STRIP everything ... so its lost already ...
any help would be cool, i dont believe this is a file issue, more a conversion cli one and my lack of IM cli knowledge..

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PSD Conversion

Post by fmw42 »

convert rgb.jpg +profile "*" -profile "path/to/rgb.icc" -profile "path/to/cmyk.icc" -strip -sampling-factor 1x1 -quality 95 -compress JPEG
Three issue I see.

1) I have not had success using +profile *. I think the correct way is +profile *.ic* to cover both .icc and .icm.

2) rgb.icc should probably be sRGB.icc

3) -strip will remove the profile you just added, so all the work you went through to change the profile is now lost.


convert rgb.jpg +profile *.ic* -profile "path/to/srgb.icc" -profile "path/to/cmyk.icc" -sampling-factor 1x1 -quality 95 -compress JPEG cmykimage.jpg

You can check the file before processing by scripting to look for any icc or icm profile in the -verbose info. If none is present, then do the above command.

If you find one, then just do

convert rgb.jpg -profile "path/to/cmyk.icc" -sampling-factor 1x1 -quality 95 -compress JPEG cmykimage.jpg

Locked