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

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
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

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

Post 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 .
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

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

Post 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"
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

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

Post 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 .
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

You can share your file on something like DropBox/OneDrive. And can you upgrade to the most recent version of ImageMagick?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

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

Post 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 .
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

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

Post 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"
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo »

Sorry, that's too large for me to download.
snibgo's IM pages: im.snibgo.com
mikmach
Posts: 42
Joined: 2015-02-06T07:50:43-07:00
Authentication code: 6789

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

Post 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)
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

Can you try the most recent version of IM that was released yesterday?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

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

Post by pssvarma8881 »

Hi ,

Thanks for your response .

the sample images working well with ImageMagick 7.0.3-1 .
Post Reply