Export Layers as PNG

File->Export Layers->

Prompts for a folder to save PNG files. Pretty straightforward.

Tested in 2.6.1 on linux and 2.6.6 on XP.

Average: 5 (1 vote)
AttachmentSize
export_layers-0.2.py1.17 KB

Comments

if you want to save layers

if you want to save layers with alpha channel you only need to comment tmp.flatten(). The code looks like:

for layer in dupe.layers:
layer.visible = 1
name = layer.name + ".png"
fullpath = os.path.join(path, name);
tmp = dupe.duplicate()
#tmp.flatten()
pdb.file_png_save(tmp, tmp.layers[0], fullpath, name, 0, 9, 1, 1, 1, 1, 1)
dupe.remove_layer(layer)

Thanks for the script

nice

I should add that as an option perhaps - to flatten or not.

in windows may be a problem

in windows may be a problem mostly how to chose/wrote the path

As use / instead then \ ..or viceversa

and blank spaces in the path names, quite commune in Windows( As example C/Documents and Settings/ ) would be
supported ?

no problem

Nah - I just tested in XP and it's OK. Both windows and linux have a funkiness though: you have to show the location bar in the file chooser. When you are in the directory to export to, enter a period (.) in the location bar and *then* click open or press enter.

But \ or / does not matter, nor do spaces in the path.

fixed the quirk

the script now prompts for a dir, so you don't have to put the "." in there... I used PF_FILE initially, but PF_DIRNAME is correct.

test, test, testing 1, 2, 3...

spam filter working yet? :)