Page 1 of 1

convert corrupting extracted layers in multi-layer PSD

Posted: 2007-04-06T10:02:11-07:00
by pstdenis
Hello,
I am using ImageMagick 6.3.3
and "convert -set dispose Background -coalesce whatever.psd layers.png"
I get a png for each layer in the original photoshop file however for the later layers (depending on the complexity of the layers I believe) the pngs are corrupt. I have repeated the behavior outputing BMPs and removing the -coalesce and -set dispose Background
Here is the psd file I have been using
http://apu.celt.sunysb.edu/uploadimages/1175810561.psd
I am using Debian and Ubuntu.

Re: convert corrupting extracted layers in multi-layer PSD

Posted: 2007-04-10T17:59:34-07:00
by anthony
before I even read your example further. You need to understand the different between a
setting option and an operator option!
http://www.imagemagick.org/Usage/basics/

You started your example using -set which is an operator that only effects images IN MEMORY, and you have no images in memory yet! On the other hand -dispose sets a setting that effects images that are being read in or created!

So lets adjust your example...

Code: Select all

   convert whatever.psd -set dispose Background -coalesce layers.png
For the next thing. PNG only can save a single image, it is part of the formats nature!
if you have multiple image images they will save as layers-#.png where # goes from 0 to whatever. If you have more than 10 images you the layers will not sort in the right order.

now trying this with your example image... identify reports quite a mix of image sizes, and offsets, (virtual canvas matchs image size, which is bad when an image also has an offset!)
But at least they all appear to match up to the original image, (with first image repeated with a alpha channel) so that should be okay. The last image however does look corrupt.

trying a progressive flatten

Code: Select all

convert 1175810561.psd -set dispose None -coalesce x:
confirms things do match up.

I can not find anything really wrong (except the last). I am using the very latest IM version.
There was a bug I found on the weekend in -coalesce involving IM not replicating the virtal canvas size from the first image to later images, so that may be the problem. Many PNG browsers (including firefox) stuffs up if the image is not contains properly on the virtual canvas.

Try this...

Code: Select all

convert 1175810561.psd -set dispose Background -coalesce -repage 400x300 layers.png
and see if that fixed your problem. If so get the very latest IM (at least 6.3.3-7).

also look at that final image in your PSD file.

Re: convert corrupting extracted layers in multi-layer PSD

Posted: 2007-04-11T04:56:12-07:00
by anthony
I stand corrected. The last image in your PSD file is not corrupt. Gimp shows that image, another mask, to be correct. Thus IM much be corrupting the read of the last image in the provided PSD file. I have reported this for further action.

Re: convert corrupting extracted layers in multi-layer PSD

Posted: 2007-06-29T09:28:22-07:00
by pstdenis
As a workaround, is there another layered format that can separated by imagemagick? We are working on a tool for going from a multilayered image in photoshop/gimp to a clickable image map and it is shame that we have to restrict the number of layers that can be used.