Closed kkgg0521 closed 3 months ago
this is my code ` import psapi
layered_file = psapi.LayeredFile.read("LR8224.psd")
print(layered_file.width) layered_file.width = 500 layered_file.height = 500
layered_file.write("123.psd") `
layered_file = psapi.LayeredFile.read("LR8224.psd")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte
Let me have a look once im home! Is there any way you could provide me with the file in question if it is not confidential.
That being said I recently pushed a change that fixed a bug relating to filepaths where reading a file without a path would fail.
You could try instead
psapi.LayeredFile.read("./LR8224.psd")
I think this should fix your error but let me know if it doesnt. This bugfix will be part of the 0.5.0 release once I get the time to implement some other features :)
@kkgg0521
thank you very much . can you give me you email?
Yes sure, its emildohne@gmail.com :). Ill try and have a look tonight or tomorrow morning my time!
Hey @kkgg0521 I gave a look at the file and was able to read it just fine using the latest pip installable photoshopapi version of 0.4.0 without any errors. Even when omitting the "./" prefix from the path I only got a create_directories error and not a UnicodeDecodeError.
Mind letting me know what python version and PhotoshopAPI version you are running? That way I can see if I can recreate your setup.
Additionally if you could let me know what OS you are running on that could help :)
python 3.7 PhotoshopAPI 0.4.0 win11
我切换了电脑 发现正常读取了。
这个问题解决了 希望可以早日用上0.5.0版本的软件 感谢
Glad it worked out, in general something that is TODO is the parsing of unicode layer names as I hadnt implemented that yet whicv is why your layer names might come out funny.
Ill open an issue for it
这个项目我很感兴趣,他十分强大。
Hey, I assume this is a duplicate of the last ticket which ive translated from chinese? In which case I would delete the other one since it is not in english.
As for your question, if by drawing board you mean the canvas itself theres multiple options, you can either modify it on initialization using the appropriate constructor or directly modify the properties after construction if you wish to resize it after adding all the layers
Here is the relevant cpp reference https://photoshopapi.readthedocs.io/en/latest/code/layeredfile.html The attributes for cpp are
m_Width
andm_Height
Here is the relevant python reference https://photoshopapi.readthedocs.io/en/latest/python/layeredfile.html The attributes for python are
width
andheight
Hope this helps!