Previous section To contents Next section

12.22 Image.XCF

DESCRIPTION

METHOD
Image.XCF.decode

SYNTAX
object decode(string data)

DESCRIPTION
Decodes a XCF image to a single image object.

NOTE
Throws upon error in data, you will loose quite a lot of information by doing this. See Image.XCF._decode and Image.XCF.__decode

METHOD
Image.XCF.decode_layers

SYNTAX
array(object) decode_layers( string data )

DESCRIPTION
Decodes a XCF image to an array of Image.Layer objects

The layer object have the following extra variables (to be queried using get_misc_value):

image_xres, image_yres, image_colormap, image_guides, image_parasites, name, parasites, visible, active

METHOD
Image.XCF._decode

SYNTAX
mapping _decode(string|object data, mapping|void options)

DESCRIPTION
Decodes a XCF image to a mapping, with at least an 'image' and possibly an 'alpha' object. Data is either a XCF image, or a XCF.GimpImage object structure (as received from __decode)

 Supported options
([
"background":({r,g,b})||Image.Color object
"draw_all_layers":1,
Draw invisible layers as well

"draw_guides":1, Draw the guides

"draw_selection":1, Mark the selection using an overlay

"ignore_unknown_layer_modes":1 Do not asume 'Normal' for unknown layer modes.

"mark_layers":1, Draw an outline around all (drawn) layers

"mark_layer_names":Image.Font object, Write the name of all layers using the font object,

"mark_active_layer":1, Draw an outline around the active layer ])

NOTE
Throws upon error in data. For more information, see Image.XCF.__decode

METHOD
Image.XCF.__decode

SYNTAX
object __decode(string|mapping data,  mapping|void options)

DESCRIPTION
Decodes a XCF image to a Image.XCF.GimpImage object.

Returned structure reference

class GimpImage { int width; int height; int compression; int type; int tattoo_state; float xres = 72.0; float yres = 72.0; int res_unit; Image.Colortable colormap; Image.Colortable meta_colormap; array(Layer) layers = ({}); array(Channel) channels = ({}); array(Guide) guides = ({}); array(Parasite) parasites = ({}); array(Path) paths = ({});

Layer active_layer; Channel active_channel; Channel selection; }

class Layer { string name; int opacity; int type; int mode; int tattoo; mapping flags = ([]); int width, height; int xoffset, yoffset; array (Parasite) parasites; LayerMask mask; Hierarchy image; }

class Channel { string name; int width; int height; int opacity; int r, g, b; int tattoo; Hierarchy image_data; object parent; mapping flags = ([]); array (Parasite) parasites; }

class Hierarchy { Image.Image img; Image.Image alpha; int width; int height; int bpp; }

class Parasite { string name; int flags; string data; }

class Guide { int pos; int vertical; }

class Path { string name; int ptype; int tattoo; int closed; int state; int locked; array (PathPoint) points = ({}); }

class PathPoint { int type; float x; float y; }

METHOD
Image.XCF.___decode

SYNTAX
object ___decode(string|mapping data)

DESCRIPTION
Decodes a XCF image to a mapping.

Structure reference

([ "width":int, "height":int, "type":int, "properties":({ ([ "type":int, "data":string, ]), ... }), "layers":({ ([ "name":string, "width":int, "height":int, "type":type, "properties":({ ([ "type":int, "data":string, ]), ... }), "mask":0 || ([ "name":string, "width":int, "height":int, "properties":({ ([ "type":int, "data":string, ]), ... }), "image_data":([ "bpp":int, "width":int, "height":int, "tiles":({ string, ... }), ]), ]), "image_data":([ "bpp":int, "width":int, "height":int, "tiles":({ string, ... }), ]), ]), ... }), "channels":({ "name":string, "width":int, "height":int, "properties":({ ([ "type":int, "data":string, ]), ... }), "image_data":([ "bpp":int, "width":int, "height":int, "tiles":({ string, ... }), ]), }), ])


Previous section To contents Next section