We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I make all layers is visible,then save a new psd file, the new psd file's size of width、height、top、and bottom is error.
'''this is my code ''' #!/usr/bin/env python
import os import pytoshop from pytoshop.user import nested_layers
def changevisible(filename, dtype=0): visible_status = False if dtype == 0 else True tmp_name = filename + '.bak' with open(filename, 'rb') as fd: psd = pytoshop.PsdFile.read(fd) print(psd.width, psd.height) layers = nested_layers.psd_to_nested_layers(psd) for layer in layers: print(layer.name, layer.top, layer.right, layer.left, layer.bottom) layer.visible = visible_status psd2 = nested_layers.nested_layers_to_psd(layers, psd.color_mode) with open(tmp_name, 'wb') as fd: psd2.write(fd) os.remove(filename) os.rename(tmp_name, filename)
filename = r"C:\Users\admina\Desktop\1.psd" changevisible(filename, 1)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
I make all layers is visible,then save a new psd file, the new psd file's size of width、height、top、and bottom is error.
What I Did
'''this is my code '''
#!/usr/bin/env python
-- coding: utf-8 --
import os
import pytoshop
from pytoshop.user import nested_layers
def changevisible(filename, dtype=0):
visible_status = False if dtype == 0 else True
tmp_name = filename + '.bak'
with open(filename, 'rb') as fd:
psd = pytoshop.PsdFile.read(fd)
print(psd.width, psd.height)
layers = nested_layers.psd_to_nested_layers(psd)
for layer in layers:
print(layer.name, layer.top, layer.right, layer.left, layer.bottom)
layer.visible = visible_status
psd2 = nested_layers.nested_layers_to_psd(layers, psd.color_mode)
with open(tmp_name, 'wb') as fd:
psd2.write(fd)
os.remove(filename)
os.rename(tmp_name, filename)
filename = r"C:\Users\admina\Desktop\1.psd"
changevisible(filename, 1)
The text was updated successfully, but these errors were encountered: