Created
September 22, 2021 21:42
-
-
Save lonequantum/795bff7624de585335ac472e356236bf to your computer and use it in GitHub Desktop.
Saves XCF layers to 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
#!/bin/sh | |
# Requires gimp and gimp-python | |
convert_xcf_to_pngs() { | |
infile=$1 | |
outfiles_dir=$2 | |
{ | |
cat <<END | |
def convert(infile, outfiles_dir): | |
img = pdb.gimp_file_load(infile, infile) | |
for layer in img.layers: | |
outfile = outfiles_dir + "/" + layer.name + ".png" | |
print(layer.name) | |
pdb.gimp_file_save(img, layer, outfile, outfile) | |
pdb.gimp_image_delete(img) | |
END | |
echo "convert(\"$infile\", \"$outfiles_dir\")" | |
echo "pdb.gimp_quit(1)" | |
} | gimp -i --batch-interpreter=python-fu-eval -b - | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment