You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Photoshop adds an copy suffix to layer names when duplicating layers. It doesn't do this when duplicating layers created with pytoshop. If a pytoshop layer is manually renamed in PS, the desired behaviour is restored.
I would like to help track the cause of this issue but have no idea where to start. The name itself seems to be created correctly as pascal string padded with 4 bytes. I can replicate this behaviour across versions CC 2014 to 2018 on OS X and Windows.
What I Did
""" Renaming issue when duplicating layers inside Photoshop example """
from pathlib import Path
import numpy as np
from pytoshop.enums import ColorChannel, ColorMode
from pytoshop.user import nested_layers
# Color channel types RGBA
CHANNEL_TYPES = [ColorChannel.red, ColorChannel.green, ColorChannel.blue, ColorChannel.transparency]
# Create Image Layer
layer = nested_layers.Image(name='Test_Layer', color_mode=ColorMode.rgb)
# Fill Layer with random image data
img_np = np.array(np.random.rand(256, 256, 3) * 255, dtype=np.uint8)
num_channels = range(0, img_np.shape[2])
for channel_type, channel_idx in zip(CHANNEL_TYPES, num_channels):
layer.set_channel(channel_type, img_np[..., channel_idx])
# Create PsdFile from layer list
psd_obj = nested_layers.nested_layers_to_psd(layers=[layer], color_mode=ColorMode.rgb)
psd_file = Path(__file__).parent / 'test_psd.psd'
with open(psd_file, 'wb') as file:
psd_obj.write(file)
The text was updated successfully, but these errors were encountered:
Description
Photoshop adds an copy suffix to layer names when duplicating layers. It doesn't do this when duplicating layers created with
pytoshop
. If a pytoshop layer is manually renamed in PS, the desired behaviour is restored.I would like to help track the cause of this issue but have no idea where to start. The name itself seems to be created correctly as pascal string padded with 4 bytes. I can replicate this behaviour across versions CC 2014 to 2018 on OS X and Windows.
What I Did
The text was updated successfully, but these errors were encountered: