12 February, 2014

Using Gimp Images (xcf files) directly inside LyX

Long ago, I was tired manually converting images to PDF, for papers etc. And I have been using SVGs directly inside LyX, which works quite nice. For my current work I also need some pixel images and composed them in Gimp. Gimp puts out XCF images that contain all layer information, etc.

Unfortunately, LyX (2.0.7) cannot fully handles these images out of the box. The preview is fine, but when generating PDFs LyX/LaTeX fails. To fix this you need to do add following settings in LyX:

1. Preferences -> File Handling -> File Formats -> [New] ->
Format: XCF
Short Name: Gimp Image
Extension: xcf

2. Preferences-> Converters:
From: XCF, To: PNG
Converter: convert -layers merge $$i $$o

This will flatten the file, so make sure your current layer arrangement, etc. looks like your desired final out put. Note that there is  no need for an additional XCF to PDF setting, since the internal PNG to PDF converters will be for that.