Problem when converting XCF to PNG in Command Line

scientillion

New Member
Joined
Aug 2, 2022
Messages
4
Reaction score
2
Credits
42
I am getting the following error when trying to use ImageMagick for converting a xcf file to png:

user@drfaust:~/$ convert Untitled.xcf Untitled.png
convert-im6.q16: memory allocation failed `Untitled.xcf' @ error/xcf.c/ReadXCFImage/1354.
convert-im6.q16: no images defined `Untitled.png' @ error/convert.c/ConvertImageCommand/3258.

Any idea how to fix this?
 


Not sure, it might be a bug with ImageMagick, or it could be some problem, or incompatibility with the .xcf file itself. :/

Another option might be to install the xcftools package, which if memory serves - contains a utility called xcf2png which can convert from .xcf to .png.

If you're on a Debian, or Debian derived distro I'm pretty certain the package is called xcftools, you should be able to install it via apt. if you're on another distro - you'll have to search your package manager and see if you can find it and install it with whatever package management system your installed distro uses!
 
Which version of GIMP did you use to create the image and what is your ImageMagick version?
 
The OP did not say if he had GIMP installed, but it is a good GUI option.

... and welcome to linux.org to both @scientillion and @appie :)

If the OP uses GIMP, he can select the .xcf file and open it with GIMP, then choose export as and choose .png from the filetypes.

Chris Turner
wizardfromoz
 
Yeah, it is good GUI option... and according to this tool you need the latest version of ImageMagick to convert xcf images created with GIMP 2.0 and higher. Images from GIMP 1.x should also work with older versions of ImageMagick.
 
Last edited:
Thanks a lot for all the replies! I tried xcf2png but it also threw a warning and did not produce usable output in my case:

xcf2png Untitled.xcf
Warning: XCF version 11 not supported (trying anyway...)

GIMP was not really an option for my use-case since I wanted to convert a bunch of files in the command line. What worked was using the latest version of ImageMagick (7.1.0). I used the portable, static build which was running like a charm on my Ubuntu install :)
 
I cannot really help you as I haven't tried to do that before. That said, I switched from ImageMagick to GraphicsMagick a a couple of years ago. It was faster and more efficient. Not to mention, I was having a hell of a problem getting the most recent (at the time) Python / ImageMagick to compile together.
 
Well, in fact upgrading to ImageMagick 7.1.0 fully fixed the issue for me. I downloaded the static build directly from their website (Before I used 6.9.10-23, which threw the error).
 
There are lots of paid available on the web, you can convert your bunch of files as well.
 
GIMP was not really an option for my use-case since I wanted to convert a bunch of files in the command line. What worked was using the latest version of ImageMagick (7.1.0). I used the portable, static build which was running like a charm on my Ubuntu install

I know this problem has already been solved, but I thought I’d mention this.

You may not know it, but GIMP has a batch mode and a couple of scripting interfaces. It is possible to write scripts in GIMP that can batch convert files, or apply effects/filters/transformations to batches of files.

The following link documents a way to batch convert using Gimps default script-fu scripting interface - which is scheme based: (basically a dialect of lisp)

And there is the much more user friendly Python based Python-fu scripting interface:

Using one of Gimps scripting interfaces, you could create a script that will batch convert files in gimp - however, this route will probably only be useful if you already have some prior programming experience.

But if you do use Gimp a lot, then learning a bit about at least one of it’s scripting interfaces is time well spent.

Gimp doesn’t have any kind of macro recording/playback functionality, but for any repetitive actions you perform on files, or even particular layers in files - you can use the scripting interfaces to write your own scripts/plugins/extensions.

Again, it may take some time to learn how to use gimps scripting features, especially if you have little, or no programming experience. But if you spend a lot of time using Gimp, then adding your own extensions/plugins can be worthwhile in the long run.

I haven’t used Gimp for much recently, but I’ve used both of the scripting interfaces in the past. Some years back I helped write some scripts/plugins that one of my artist friends needed, in order to speed up his workflow for some of his projects. Including a few scripts that did batch conversion, or applied a series of effects/transformations to images, or even named layers in batches of files.

Unfortunately, I don’t know where any of those scripts are. They might be on one of my many backup drives, or they might even be on a data CD/DVD in the loft!! :/
 
Couldn't decide between a Love and a Haha (re the loft) there so went with the Love, Jas.
 

Members online


Top