It is currently Tue Jul 02, 2024 1:33 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Exporting as PSD from Python?
PostPosted: Wed Feb 03, 2021 6:07 pm  (#1) 
Offline
GimpChat Member

Joined: Jan 30, 2021
Posts: 5
I am importing a PSD file and exporting a composite - that works fine. I can also save it as an XCF which is helpful for debugging. Is it also possible to export back to PSD from a GIMP script? I know the command exists in the program.
I have tried both of these, where export_file_psd is the full path name ending in '.psd'. I think pdb.gimp_file_save would be correct but I am not sure what to pass in for the drawable, since I want to export everything, not just a single layer. pdb.gimp_xcf_save saves it in XCF format even if the file is named with a different extension.

pdb.gimp_xcf_save(RUN_NONINTERACTIVE, image, None, export_file_psd, export_file_psd)
pdb.gimp_file_save(image, image, export_file_psd, '?')


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Exporting as PSD from Python?
PostPosted: Thu Feb 04, 2021 5:53 am  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
You have to create a new drawable with whatever you want to export. Two possibilities:

1) gimp_layer_new_from_visible and export the result
2) duplicate the image, flatten it, and export its single layer.

_________________
Image


Top
 Post subject: Re: Exporting as PSD from Python?
PostPosted: Thu Feb 04, 2021 12:51 pm  (#3) 
Offline
GimpChat Member

Joined: Jan 30, 2021
Posts: 5
ofnuts wrote:
You have to create a new drawable with whatever you want to export. Two possibilities:

1) gimp_layer_new_from_visible and export the result
2) duplicate the image, flatten it, and export its single layer.


That is basically what I am doing when I export a composite as a PNG or JPG. That works fine.

But I don't think either of those does what I want to do in the case of exporting a PSD. I am pretty sure they will both only output a single layer, ever. In GIMP, if you open a PSD and then Export as PSD, it exports a PSD file with all the layers intact (it might rename layers that had duplicate names), not a composite. So it seems like GIMP's API does not make this feature available?


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Performance of adjusting layers and exporting with Python Fu

5

No new posts Trouble exporting to .psd

2

No new posts Filled path not exporting with fill

4

No new posts Convert GIMP plugin from Python 2 to Python 3

4

No new posts Attachment(s) exporting 256-color indexed png & gif missing transparency

9



* Login  



Powered by phpBB3 © phpBB Group