I have a folder with a lot of xcf files which I want all to be converted to png files, at best via a one-liner from bash.
How can I achieve such a task?
I have a folder with a lot of xcf files which I want all to be converted to png files, at best via a one-liner from bash.
How can I achieve such a task?
One-liner from bash:
for i in *.xcf; do xcf2png -f $i -o $i.png; done
You can use GIMP Image editor and use Export to tool. Use Ctrl-Shift-E as shortcut.
Or you could use convert from imagemagick:
convert filename.xcf filename.png
You could also use xcftools (sudo apt-get install xcftools), which has a utility called xcf2png that does this job perfectly.
xcf2png image.xcf -o image.png
same of @k0pernikus, but remove xcf extension from output filename
for i in *.xcf; do xcf2png -f $i -o "${i%.*}.png"; done
My one-liner using convert from imagemagik:
for i in Amplicon*.xcf; do convert $i ${i/xcf/png}; done
I had to keep my 'Amplicon' name because otherwise, it finds hidden xcf files in the directory and exports all the layers as individual PNGs haha. But it works! And the variant not using a loop (and could be parallelized)
find . -name "Amplicon*xcf" | xargs -I {} convert {} {}.png
But... I coudn't remove the '.xcf" from the filename. Still works!
Based on J. Auger's solution:
find . -name "Amplicon*xcf" | parallel convert {} {.}.png