How to convert XCF to PNG using GIMP from the command-line?

后端 未结 5 1871
误落风尘
误落风尘 2021-02-01 03:02

As part of my build process I need to convert a number of XCF (GIMP\'s native format) images into PNG format. I\'m sure this should be possible using GIMP\'s batch mode, but I h

5条回答
  •  独厮守ぢ
    2021-02-01 03:41

    Use xcftools

    It's possible that this tool wasn't available (or in any case widely known) at the time this question was originally asked, but the xcf2png terminal command from the xcftools package does exactly what you ask and is very good. I use it for my thesis scripts and would be my go-to choice for this question.

    From the documentation:

    This is a set of fast command-line tools for extracting information from the Gimp's native file format XCF.
    The tools are designed to allow efficient use of layered XCF files as sources in a build system that use 'make' and similar tools to manage automatic processing of the graphics.
    These tools work independently of the Gimp engine and do not require the Gimp to even be installed.

    "xcf2png" converts XCF files to PNG format, flattening layers if necessary. Transparency information can be kept in the image, or a background color can be specified on the command line.


    (PS. I spotted xcftools mentioned in the comments just after I decided to post an answer about it, but I'm posting anyway as that comment was easy to miss (I saw it because I specifically checked for it) and I think xcftools deserves a proper answer's slot, as it really is the most appropriate answer at this point in time.)

提交回复
热议问题