opacity in psd files not working correctly in magick++?
Posted: 2010-01-14T18:50:18-07:00
Hello - I'm using ImageMagick 6.5.9.
I've created a photoshop file using the following method:
1) Create a photoshop file
2) Select "new layer from background" so you have a 1 layer file
3) Fill the background with red using the paint bucket tool
4) Set the layer opacity to something other than 100% (i.e. 25%).
I'm trying to push this file through ImageMagick++ and I can't get anything useful out of layers that have opacity in them. I've simplified the code down to the following:
Magick::InitializeMagick(NULL);
std::vector<Image> images;
readImages( &images, "test.psd" );
images[0].write("test0.png");
images[1].write("test1.png");
The first save of the entire image, test0, looks correct. But the second save of just the one layer, test1, comes out completely transparent.
Note that when the opacity of the layer is 100%, both saves look correct.
If I call images[1].pixelColor(5,5), I get a color of type RGBA, but a pixel opacity of 65535, which is transparent. So somewhere along the way the pixel is getting set to transparent instead of solid, and any opacity setting has been lost?
Any ideas on how to work around this issue (note: The issue is not because there is only 1 layer in the file, when I have many layers in the file, the problem still happens, I'm just trying to make the example as simple as possible).
Thanks.
I've created a photoshop file using the following method:
1) Create a photoshop file
2) Select "new layer from background" so you have a 1 layer file
3) Fill the background with red using the paint bucket tool
4) Set the layer opacity to something other than 100% (i.e. 25%).
I'm trying to push this file through ImageMagick++ and I can't get anything useful out of layers that have opacity in them. I've simplified the code down to the following:
Magick::InitializeMagick(NULL);
std::vector<Image> images;
readImages( &images, "test.psd" );
images[0].write("test0.png");
images[1].write("test1.png");
The first save of the entire image, test0, looks correct. But the second save of just the one layer, test1, comes out completely transparent.
Note that when the opacity of the layer is 100%, both saves look correct.
If I call images[1].pixelColor(5,5), I get a color of type RGBA, but a pixel opacity of 65535, which is transparent. So somewhere along the way the pixel is getting set to transparent instead of solid, and any opacity setting has been lost?
Any ideas on how to work around this issue (note: The issue is not because there is only 1 layer in the file, when I have many layers in the file, the problem still happens, I'm just trying to make the example as simple as possible).
Thanks.