Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to save a valid psd file #36

Open
duncankam opened this issue Sep 4, 2023 · 1 comment
Open

Failed to save a valid psd file #36

duncankam opened this issue Sep 4, 2023 · 1 comment

Comments

@duncankam
Copy link

  • psdwriter version:
  • Python version: 3.11
  • Operating System: mac

I

I simply open the file, call psd_to_nested_layers(), then call nested_layers_to_psd() and output the psd file.
The file may have still all the layers there, but it is no longer viewable with Preview, programmatically I can still find all layers there. Just a patch of black in Preview.

What I Did

import pytoshop
from pytoshop import enums
from pytoshop.user import nested_layers
from PIL import Image
import io

in_fpn = 'original.psd'
out_fpn = 'updated.psd'

def test_nested_layers_no_adjust(filename, outfilename):

with open(filename, 'rb') as fd:
    psd = pytoshop.read(fd)

    layers = nested_layers.psd_to_nested_layers(psd)
    
    for layer in layers:
      print(layer.name)

    psd2 = nested_layers.nested_layers_to_psd(layers, enums.ColorMode.rgb )

    with open(outfilename, 'wb')as fo:
       psd2.write(fo)

test_nested_layers_no_adjust(in_fpn, out_fpn)

@duncankam
Copy link
Author

After investigation, this issue is similar to #30.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant