Last active
August 29, 2015 14:07
-
-
Save agateau/8e4e035b66c520f85077 to your computer and use it in GitHub Desktop.
Save GIMP layers as individual png files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
Saves all visible layers of an image as individual png files in the same | |
folder as the image, using <layer-name>.png for the name. | |
To use it: | |
- Save this file in ~/.gimp-$version/plug-ins/ | |
- Restart GIMP | |
- Open the Image menu, select "Save Layers" | |
Based on instructions from http://stackoverflow.com/questions/20522304/gimp-save-all-layers-to-files-with-the-layers-size | |
""" | |
import os | |
from gimpfu import * | |
def plugin_main(timg, tdrawable): | |
folder = os.path.dirname(timg.filename) | |
for layer in timg.layers: | |
if not layer.visible: | |
continue | |
name = os.path.join(folder, layer.name + '.png') | |
pdb.gimp_file_save(timg, layer, name, name) | |
register( | |
"python_fu_save_layers", | |
"Save layers as individual images", | |
"Save layers as individual images", | |
"Aurelien Gateau", | |
"Aurelien Gateau", | |
"2014", | |
"<Image>/Image/Save Layers...", | |
"RGB*, GRAY*", | |
[], | |
[], | |
plugin_main) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment