converting PSB/PSD files with layer masks
Posted: 2012-02-25T17:07:58-07:00
One of the principal reasons for using Photoshop PSB or PSD format is its support for layers. But as far as I can tell, convert is unable to properly flatten a PSB or PSD that uses layer masks.
For example, in http://db.tt/JoFppTLt you'll find several files
heads1_mask.psb
heads1_applymask.psb
and ppm versions of these files created using, e.g.
convert -flatten heads1_mask.psb heads1_mask.ppm
heads1_mask.ppm shows buggy results
heads1_applymask.ppm shows the desired results
I tested with Version: ImageMagick 6.7.2-0 2012-02-25 Q16 http://www.imagemagick.org
The heads1_mask.psb file has two layers with layer masks indicating partial transparency (what you typically want to do, when editing layers) composited over a background image. All three layers are RGB 8 bit. This image was not saved with a compatibility layer.
When you do a convert, as above, the mask is erroneously ignored (treated as opaque everywhere) for one layer, and the other layer appears to be suffering from decompression errors (the y coordinates are correct, but pixels have the wrong x coordinate, or color, or transparency).
Changes that DO NOT cause the bug to disappear:
Adding a compatibility layer.
Saving in PSD format instead of PSB.
Hide one layer (scrambled pixel effect remains).
Delete a layer (this causes the scramble to go away, but the mask is still incorrectly ignored).
Changes that DO cause the bug to disappear:
Do "Layer / Layer Mask / Apply" to each layer (I'd prefer that I not be forced to ask our users to do this to all their PSB files.) The heads1_applymask.psb was created this way.
Do "Layer / Layer Mask / Delete" to each layer (but this changes the composite image).
Do "Layer / Flatten" (but that's why I was running convert in the first place...).
In the tests I've done, it appears that PSB/PSD files with two layers with layer mask typically result in the masks being ignored, and three or more layers with layer mask result in masks being ignored and layers getting scrambled. I've never seen convert do a correct job of flattening a PSB or PSD file that uses layer masks.
This looks like a fundamental bug in ImageMagick's PSB/PSD support. Could it be fixed?
For example, in http://db.tt/JoFppTLt you'll find several files
heads1_mask.psb
heads1_applymask.psb
and ppm versions of these files created using, e.g.
convert -flatten heads1_mask.psb heads1_mask.ppm
heads1_mask.ppm shows buggy results
heads1_applymask.ppm shows the desired results
I tested with Version: ImageMagick 6.7.2-0 2012-02-25 Q16 http://www.imagemagick.org
The heads1_mask.psb file has two layers with layer masks indicating partial transparency (what you typically want to do, when editing layers) composited over a background image. All three layers are RGB 8 bit. This image was not saved with a compatibility layer.
When you do a convert, as above, the mask is erroneously ignored (treated as opaque everywhere) for one layer, and the other layer appears to be suffering from decompression errors (the y coordinates are correct, but pixels have the wrong x coordinate, or color, or transparency).
Changes that DO NOT cause the bug to disappear:
Adding a compatibility layer.
Saving in PSD format instead of PSB.
Hide one layer (scrambled pixel effect remains).
Delete a layer (this causes the scramble to go away, but the mask is still incorrectly ignored).
Changes that DO cause the bug to disappear:
Do "Layer / Layer Mask / Apply" to each layer (I'd prefer that I not be forced to ask our users to do this to all their PSB files.) The heads1_applymask.psb was created this way.
Do "Layer / Layer Mask / Delete" to each layer (but this changes the composite image).
Do "Layer / Flatten" (but that's why I was running convert in the first place...).
In the tests I've done, it appears that PSB/PSD files with two layers with layer mask typically result in the masks being ignored, and three or more layers with layer mask result in masks being ignored and layers getting scrambled. I've never seen convert do a correct job of flattening a PSB or PSD file that uses layer masks.
This looks like a fundamental bug in ImageMagick's PSB/PSD support. Could it be fixed?