How to batch convert xcf to png

Posted 4 years ago
by Russell to gift of code

My favorite image manipulator program is GIMP and I often find myself with a directory full of xcf (gimp project files) that I would like to convert into PNGs for use on the web or in a video game. I like to keep my "master" copy of image assets in xcf format to preserve layer and history meta-data.

Today I was experimenting with an idea called sketch notes on some of my personal blog posts. I ended up with several xcf files which I needed to to export to png for use on the blog.

Opening each project individually to perform an export felt tedious and time consuming. There had to be a better way, so I started a search!

Duckduckgo linked me to xcf2png, which is a perfect match.

This is how I installed xcf2png:

sudo yum install xcftools

This is the one-line bash program I wrote to batch convert xcf to png:

for file in *.xcf; do xcf2png "$file" > "$file.png" ; done

Tada! like magic I now had both the original xcf and a new png of each image!

Oh I made a practice sketch note for this post too! : )

infographic of batch converting xcf to png files
Browse the blog archives or subscribe to the full-text feed

Let us capture, store, and update webpage screenshots for you.

See Plans and Pricing
No Risks, Pay-as-you-go