From BlenderWiki

Jump to: navigation, search
Import GIMP Image to Scene (.xcf, .xjt)
Imports GIMP images and creates planes for each layer, mantaining the original layout and appearance of the 2D composition in 3D space. (help is needed to port xcftools to windows/mac)
UI location Group: Import/Export
Version 2.0 Author(s) Daniel 'ZanQdo' Salazar
Blender 2.5 Rev:#33420 License GPL


Executable information
File name io_import_gimp_image_to_scene.py
Current version download https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/io_import_gimp_image_to_scene.py
External Python Modules or dependencies Requires xcftools installed to import the .xcf format



Description

This script imports GIMP .xcf or .xjt files and converts each layer into planes, mantaining their size, location and z-stacking sequence in order to reproduce the layout and appearance of the original 2D file in Blender's 3D view. The script also places the objects in blender layers and allows to define arbitrary layer grouping using naming conventions. Another important feature of this script is the possibility of reproducing the original layer compositing in Blender's compositor. Using this feature, the script will read each XCF layer's blending mode and will attempt to re-create the compositing using mix nodes, creating the complete nodetree automatically. Most of GIMP's original blending modes are supported, although some of them may have a slight different behavior in Blender's compositor.

This script doesn't support GIMP layer masks and will import text layers as images.

Usage

This script gets called through the File->Import Menu.

Xcflayers-options.png

3D Layers options

Set Camera
Creates an ortographic camera aligned to the planes reproducing the 2D file appearance
Opacity Mode
Controls how original opacity setting will be reproduced in Blender. Options are: texture alpha factor, mixer node factor, material alpha value, texture alpha factor.
Premultiply Alpha
The script uses transparent PNG as intermediate format to store the layers as textures, so created images have unassociated (straight) alpha channel. This option allows to premultiply alpha channel on those textures.
Shadeless Material
Sets shadeless option to the planes' material
Layer Separation
Defines the z-separation between each layer.
Layer Scale
Controls how original image size is translated into Blender units.
Use this value as a multiplier to modify the relationship 1px=1bu. Default value: 0,01 (100px=1bu)

Compositing options

Setup Node Compositing
Activates the re-creation of GIMP layers compositing in Blender's compositor and displays related options
Group Untagged
Puts every untagged layer in a common renderlayer.
Layer Viewers
Adds a viewer to each RenderLayer
Mixer Viewers
Adds a viewer to each mixer node, allowing to visualize each layer blending operation.

Layer grouping is performed reading common tags in .xcf layer names.

Example: layer1[background], layer2[background] as layer names in GIMP will result in layer1 and layer2 placed in RenderLayer background when imported.

XCF or XJT Layers are converted to PNG or JPG images respectively and stored in a directory named images[xcf-file-name]. If the .blend file is already saved, this directory is created in the same directory and the paths are set to relative. If the .blend file isn't saved, the directory will be created inside the directory that contains the .xcf or .xjt file and image links will be absolute.

Installation

  • Enable in Blender 2.5 Add-Ons panel.

Examples

Basic Tutorial

TV Commercial created with the script