Flatten Invisible Layers in PSD

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
tamasei
Posts: 3
Joined: 2011-10-26T09:46:46-07:00
Authentication code: 8675308

Flatten Invisible Layers in PSD

Post by tamasei »

I am trying to convert PSD files to TGA. Some of the PSD files have layers set to invisible so a straight flatten command wouldn't have those layers.

Basically doing this only yield visible layers: convert test.psd -flatten test.tga
But I need all layers in TGA file.

Is there a way to set layers to visible? or option to flatten all layers visible or not?

thanks
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Flatten Invisible Layers in PSD

Post by magick »

ImageMagick does not currently support an option to ignore the visibility layer attribute. Post a URL to one of your PSD images with an invisible layer and we will use it to add an option to the PSD coder to ignore the visibility layer attribute.
tamasei
Posts: 3
Joined: 2011-10-26T09:46:46-07:00
Authentication code: 8675308

Re: Flatten Invisible Layers in PSD

Post by tamasei »

Is there a way to composite the layers into a flatten image? If I do
convert test.psd[5] test.tga
it will get the layer into the tga file.

I'm trying out command like
convert -composite test.psd[1] -composite test.psd[2] -flatten test.tga
but it never merge the layers, tga file only has layer 1's image.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Flatten Invisible Layers in PSD

Post by fmw42 »

try

convert test.psd[1-5] -background black -flatten test.tga

or how ever many you want. Layer 0 is usually the flattened layer.

what do you get from

convert test.psd[0] test.tga
tamasei
Posts: 3
Joined: 2011-10-26T09:46:46-07:00
Authentication code: 8675308

Re: Flatten Invisible Layers in PSD

Post by tamasei »

convert test.psd[1-5] -background black -flatten test.tga
This gives me a file that's completely white. I suspect the white may be the white background on layer 1. But then again if I do
convert test.psd[5] -background black -flatten test.tga
it still gives me a file with full white.
Edit: I removed the white background layer and still same result so I don't know where is that white coming from.

For this
convert test.psd[0] test.tga
I got one file, test.tga. It's just black because none of the layer is set to visible.

There are 5 layers in the file, lowest layer is white background.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Flatten Invisible Layers in PSD

Post by fmw42 »

If there are five layers in the file, the IM indices would be 0-4. So layer [5] is not really in your image.

Try looking at each of your layers

convert image.psd image.png

see what each layer looks like. PNG does not support layers so you will get image-0.png ... image-4.png if you have 5 layers that IM can detect.

can you post a link to your PSD file so others can take a look at what is in it?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Flatten Invisible Layers in PSD

Post by anthony »

In bash you will need to quote the '[5]' or bash will convert it to just '5' (no such file)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply