Page 1 of 1

-flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-20T11:26:41-07:00
by pssvarma8881
Hi ,

we are working on multiple transformations using Image magick.

When we are testing multi-layered PSD we are not getting proper results . For some PSD some layers are missing on the converted images .

IM Version :

Version: ImageMagick 6.9.0-0 Q16 x64 2014-11-14 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo
png ps rsvg tiff webp xml zlib

Command we are using below command :


convert -verbose -resample 72 -resize 500 -transparent white -flatten +matte <SourceFile> -profile U.S. Web Coated (SWOP) v2.icc "finalimage.jpg"

Need some help on how to resolve this issue .

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-20T11:47:57-07:00
by snibgo
Your command is in the wrong order. It should read the input, do any processing (sample, resize etc) then write the output.

Resizing as well as resampling isn't generally a good idea.

If your input is CMYK, your "-transparent white" may not do what you want.

Without seeing your input file, further comments are difficult.

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-20T11:52:03-07:00
by Bonzo
As snidgo said - Your source file should be after -verbose and input.psd[0] should be all your psd layers.

Try:

Code: Select all

convert -verbose input.psd[0] -resample 72 -resize 500 -transparent white  -profile U.S. Web Coated (SWOP) v2.icc "finalimage.jpg"

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-20T13:44:53-07:00
by pssvarma8881
Hi ,

Thanks for your response .

As suggested ,I have tried the below ways
  • convert -verbose L_LG_DXN40_16037_001.psd[0] -resample 72 -resize 500 -transparent white L_LG_DXN40_16037_001.jpg

    convert -verbose L_LG_DXN40_16037_001.psd[0] -resample 72 -resize 500 L_LG_DXN40_16037_001.jpg
but unfortunately final image still a problem . I want send PSD which I am trying with ,let me know how can I upload the files to this.

Any help greatly appreciated .

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-20T13:50:32-07:00
by dlemstra
You can share your file on something like DropBox/OneDrive. And can you upgrade to the most recent version of ImageMagick?

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-20T14:24:37-07:00
by pssvarma8881
Hi ,

Here are the files .

https://1drv.ms/f/s!AuiGMeVn7efEcmDDcNSVjWIOLeM

we may not upgrade to IM7 or any other latest version as it needs to go through the whole end to end testing process ,which may not possible as of now

Thanks in advance .

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-20T21:00:49-07:00
by pssvarma8881
I tried this command which did gave us bad converted file

convert "W_CHA_DKH98_16031_001 - Copy.PSD" -transparent white -flatten -profile "sRGB Profile.icc" "W_CHA_DKH98_16031_001 - Copy.JPG"

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-20T22:43:26-07:00
by snibgo
Sorry, that's too large for me to download.

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-21T05:12:24-07:00
by mikmach
OK. This was a problem with Alpha channels which hit me in the past so I played with PS a bit.

IM interprets alpha channel/mask just the other way about than PS. You can see it in PS when you invert mask 'Color Fill 1'. After this IM command works like a charm. I don't know how force IM to invert only this mask. Simple addition of '-channel Alpha -negate' doesn't work, probably because there many saved selections. (Played with L_LG_DXN39_16037_002 - Copy.psd)

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-21T06:27:08-07:00
by dlemstra
Can you try the most recent version of IM that was released yesterday?

Re: -flatten command not working as equivalent to photoshop on Multilayered images

Posted: 2016-09-21T13:41:42-07:00
by pssvarma8881
Hi ,

Thanks for your response .

the sample images working well with ImageMagick 7.0.3-1 .