convert corrupting extracted layers in multi-layer PSD

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
pstdenis

convert corrupting extracted layers in multi-layer PSD

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert corrupting extracted layers in multi-layer PSD

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert corrupting extracted layers in multi-layer PSD

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
pstdenis

Re: convert corrupting extracted layers in multi-layer PSD

Post 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.
Post Reply