# Method Image.XCF._decode()

Method _decode

  `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 _decode

  `mapping(string:Image.Image|string) _decode(string gimp_image_data, mapping(string:mixed)|void opts)`
  `mapping(string:Image.Image|string) _decode(GimpImage gimp_image, mapping(string:mixed)|void opts)`
  `mapping(string:Image.Image|string) _decode(mapping(string:mixed) gimp_image_chunks, mapping(string:mixed)|void opts)`

Description

  Decode the image data given as the first argument. If it is a string, it is a gimp image file.

  If it is a mapping it is the value you get when calling ___decode()

  The options can contain one or more of these options:

  `"draw_all_layers" : bool` | If included, all layers will be decoded, even the non-visible ones.
  `"shrink_fact" : int` | Shrink the image by a factor of X. Useful for previews.
  `"draw_guides" : bool` | If true, draw the vertical and horizontal guides
  `"mark_layers" : bool` | If true, draw boxes around layers
  `"mark_layer_names" : bool` | If true, draw layer names in the image
  `"mark_active_layer" : bool` | If true, highlight the active layer

  The return value has this format:

  `"type" : string` | "image/x-gimp-image"
  `"img" : Image.Image` | The image
  `"alpha" : Image.Image` | The alpha channel