- 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)
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):
test_nested_layers_no_adjust(in_fpn, out_fpn)