-
Notifications
You must be signed in to change notification settings - Fork 201
Description
Describe the bug
Compositing results in a stack overflow when attempting to render set of layers containing a clipping group.
This stems from the fact that when opening, the group ("clipping" in the example file) is actually clipping into the layer that's inside itself ("red" in the example filed).
To Reproduce
Steps to reproduce the behavior:
from psd_tools import PSDImage
psd = PSDImage.open('test.psd')
psd[2] # Group('clipping' size=225x424)
psd[2][0].clip_layers # [PixelLayer('blue' size=225x424), Group('clipping' size=225x424)]
psd.composite(ignore_preview=True)Expected behavior
The document should render without errors if there were no errors while opening.
Ideally, the file would also render as expected.
File and screenshots
This PSD file was created in Clip Studio Paint, which supports clipping groups into layers.
example.zip
The group and layer order (the vertical red bar means the group/layer is clipping into the layer below):
How Clip Studio Paint renders the file:
Environment
- Python [3.10.4]
- Version [v1.9.21]
Additional notes
I made some changes to the layer loading function to support this functionality, but I'm unsure if it would cause problems with other features or not. Here's the patch:
recursive-clipping-layers.patch
Compositing appears to produce the correct output as long as the document tree is properly parsed.