Skip to content

composite() error on ex-vector layer #299

@ndeebook

Description

@ndeebook

Description:

It seems like psd_tools expects a layer with a stroke to always have a vector_mask.
Photoshop 21.2.6 gives me a psd (attached) with only a stroke (it was a vector layer converted to pixels).
Because of that, I have the following error when I try to composite() the layer:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "\Python\Python38\lib\site-packages\psd_tools\api\layers.py", line 418, in composite
    return composite_pil(self, color, alpha, viewport, layer_filter, force)
  File "\Python\Python38\lib\site-packages\psd_tools\composite\__init__.py", line 32, in composite_pil
    color, _, alpha = composite(
  File "\Python\Python38\lib\site-packages\psd_tools\composite\__init__.py", line 102, in composite
    compositor.apply(layer)
  File "\Python\Python38\lib\site-packages\psd_tools\composite\__init__.py", line 196, in apply
    color, shape, alpha = self._get_object(layer)
  File "\Python\Python38\lib\site-packages\psd_tools\composite\__init__.py", line 338, in _get_object
    color_s, shape_s, alpha_s = self._get_stroke(layer)
  File "\Python\Python38\lib\site-packages\psd_tools\composite\__init__.py", line 418, in _get_stroke
    shape = draw_stroke(layer)
  File "\Python\Python38\lib\site-packages\psd_tools\composite\vector.py", line 42, in draw_stroke
    return _draw_path(
  File "\Python\Python38\lib\site-packages\psd_tools\composite\vector.py", line 64, in _draw_path
    for subpath in layer.vector_mask.paths:
AttributeError: 'NoneType' object has no attribute 'paths'

To Reproduce:

from psd_tools import PSDImage
PSDImage.open('Forme_783.psd')[0].composite()

File and screenshots
Forme_783.zip

Environment

  • Python 3.7 and 3.8
  • psd_tools 1.9.18

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions