Multilayer XCF importer for Blender      (Versión en Español AQUÍ)


Represas - Municipalidad de San Jorge from OHWEB on Vimeo. (Blender + Gimp +Xcf_layers_suite)


Some time ago I wrote a script for importing XCF files (from Gimp) into blender, to use them in several applications, as generating 2D video effects and compositions.

The script was modified and improved later thanks to some good ideas that emerged from conversations with Guillermo Espertino (Gez) who was looking for a method for creating 2D/3D motion graphics with Blender and replace the use of proprietary software such as Adobe After Effects for the task.

Short Description:

Warning: This script only works on Linux

xcf_layers_suite is a script that allows to import a multi-layered XCF (Gimp) file into Blender.

Each layer is placed on a plane, which location and dimensions correspond to the original layers of the XCF file. A texture and shadeless material is created with the name of each layer and the planes are arranged in the scene, aligned to a camara (orthogonal or perspective) that matches the original aspect of the XCF file. Optionally each plane can be placed in individual scene layers and render layers, for later use in the node compositor.


How it works:

The script is actually two scripts: one script-fu for interacting with Gimp (xcf_layers_suite_script_fu.scm) and a Python script for Blender ( xcf_layers_suite_2_00.py ).

  • Copy xcf_layers_suite_script_fu.scm in the .gimp-2.x/scripts/ folder (open your home folder, activate the option for showing hidden folders - CTRL+H in Nautilus)

  • Copy xcf_layers_suite_2_00.py in the .blender/scripts/ folder.

  • Make sure that xcftools is installed (is available in repositories of the major linux distros)

- Once in Blender, the script can be invoked from File -> Import -> XCF Layers Suite

- A file browser will be opened, where we'll select the XCF file to import. A panel with the script settings will appear.

  • Z separation : distance between the planes in the z axis (respects the original z order of the Gimp layers)

  • Orthographic Ca : toggles between ortographic and perspective camera.

  • pack Images : packs and embeds the imported images into the blend file.

  • delete images : removes the png files that are extracted from the XCF and saved in the working folder before packing.*

  • put on layer : places each plane in a different scene layer.

  • Layer Visibilit : the visibility of each layer in the original XCF file will be honored, and the visibility of each blender scene layer will be set according to it.

  • Render Layers : creates a render layer for each scene layer imported.

  • Draw Wire : forces the wire drawing to facilitate the selection of the planes.

    * Each layer has to be converted to a PNG file before importing in blender, since Blender doesn't support the XCF file format natively. Those PNG files are linked if the images aren't packed but if they're are you can remove them safely.


-  After importing, you can press ALT+Z or SHIFT+T in order to see the actual textures in the 3D view.

-  The XCF file will be imported reflecting the position, z-order and alpha of each original layer. A camera will be created and aligned to match the original aspect and the 3D view will change to camera view.  

-  A texture and shadeless material will be created for each plane. The name of those textures and materials will reflect the original layer's name.

-  A render layer is created for each layer.

   This allows us to use the node compositor for our project.

Aternate Script with Premul option:

xcf_layers_suite_premul.py (rar file)

xcf_layers_suite_premul is a script that adds an option to activate the premul flag for the imported images. This is important mostly when we won't use the compositor and we need premultiplied alpha for the imported textures. This script only works on Blender compilations after November 4th, 2008.

Here you can download a compilation for linux (amd64) with the scripts included.

Example Blend (Than's to Gez):