File->Export Layers->as PNG
Prompts for a folder to save PNG files. Pretty straightforward. *Requires* python!
Should work with 2.4.x through 2.8.x. Will NOT work with some 2.7.x versions and the 2.8 RC1! 2.7 users should move on to current git and 2.8 RC users should upgrade to current 2.8.
Updates:
- toggle to flatten (remove transparency).
- toggle to save only visible layers
- now saves as filename + layername and special characters are removed
- toggle to remove layer offsets
- toggle to zealous crop each PNG before saving
- handle layer groups (introduced in GIMP 2.8)
NOTE: the registry added a .txt extension - you need to rename to file to just 'export_layers-0.6.py' and make executable if you're on linux.
Attachment | Size |
---|---|
export_layers-0.6.py.txt | 2.72 KB |
Comments
buggy
Seems buggy - worked better after I made this change:
newlayer = tmp.merge_visible_layers(0)
...
pdb.file_png_save(tmp, newlayer, ...
instead of
pdb.file_png_save(tmp, tmp.layers[0], ...
Handling of non-visible groups
Hi thanks for the plugin it works great, im using 2.8.4.
One area that needs some work however, in the option i can set visible layers only, but nothing about visible groups only.
I think this would be better as then we could simply hide the groups that we don't want to export, otherwise we have to hide possibly hundreds of layers.
In any case its just made my life a whole lot easier even as it stands, so thank you again
Cool
Works well, except the origin of the separate png files that were exported seems to be off.
Steps to reproduce:
* 1 xfc or psd file with multiple layers that are smaller than the image size.
* export layers -> as png
* flatten images NO, only visible layers, yes or no
* result: all layers have the wrong origin in their respective sub-pngs.
* you can see this by reopening the output png files in gimp.
To fix this add this line...
The layer needs to have its offset explicitly set before being saved. This can be done by adding the below line to the script:
tmp.layers[0].set_offsets(0, 0) # ADD THIS LINE
pdb.file_png_save(tmp, tmp.layers[0], fullpath, filename, 0, 9, 1, 1, 1, 1, 1) # BEFORE THIS LINE
Thanks - I added a toggle for
Thanks - I added a toggle for that in the plug-in.
Chris
Sorry - I meant to say: TIFF
Sorry - I meant to say:
TIFF + compression = (slightly) lossy
PNG + compression = lossless
:)
Chris
d'oh
PNG8 = lossy
PNG24+ = lossless
thanks
thanks you cr33dog
:)
Problematic Character
The plugin doesn't care about problematic characters for the file system given by the names of the layers. For example if you have a ":" character in the layer name the plugin creates only 1 empty file with a part of the layer name. I ran into this problem as i tested the standard globe animation plugin of Gimp, because it creates many layers with the ":" contained in the name.
The solution is to let the script remove / substitute all problematic characters. I did it by substituting this line:
with this one (works well for windows):
and by adding this line on top of the script:
The script looks after that like this:
And at least: Thank you for this plugin. Now i can easily create APNGs with the APNG Anime Maker.
It's a pitty, that the APNG Plugin on this site doesn't really work, that Gimp hasn't a build in filter for this and that the MNG Plugin is broken too...
the apng plugin for me works
the apng plugin for me works well
Pages