mdboom/pytoshop

how can i output the layer to a png image file.

Closed this issue · 4 comments

I also read the psd_tools source code, but it do nothing with channel id REAL_USER_LAYER_MASK(-2),
how can i merge the channel id(-2) with rgba channels together to a single png file? Any suggestion will grateful, thanks again.

Can you be more specific? Maybe provide an example PS file you are working with and the code you've written thus far.

The best I can say from your question is to multiply the user_layer_mask and the alpha channel together to create an alpha channel that also includes the mask. But, like I say, it's a bit unclear what your question is.

@mdboom
Here is the my psd file link, i what to output the layer1 to a png file, but the layer with a mask channel on it, how can i merge it with the RGBA channels? Thanks again.
https://github.com/liangweigang/python_tools/raw/master/masked_layer.psd

Thanks. The file you linked has a mask that is a different size from the other channels in the same layer. I didn't realize that was possible in the file format, but clearly it is.

Supporting this easily requires a change to pytoshop -- I've submitted PR #5 which forcibly changes the size of the mask channel to the size of the other channels in this case, which should make it much easier to work with. If you have a chance to test that PR out yourself for your own use cases, that would be great.