Gimp.Palette.get_colormap

### Method

# Gimp Paletteget_colormap

since: 3.0

#### Declaration [src]

    guint8*
    gimp_palette_get_colormap (
      GimpPalette* palette,
      const Babl* format,
      gint* num_colors,
      gsize* num_bytes
    )

#### Description [src]

This procedure returns a palette’s colormap as an array of bytes with all colors converted to a given Babl `format`.

The byte-size of the returned colormap depends on the number of colors and on the bytes-per-pixel size of `format`. E.g. that the following equality is ensured:

    num_bytes == num_colors * babl_format_get_bytes_per_pixel (format)

Therefore `num_colors` and `num_bytes` are kinda redundant since both indicate the size of the return value in a different way. You may both set them to `NULL` but not at the same time.

Available since: 3.0

#### Parameters

`format`

  Type: `Babl`

  The desired color format.

  The data is owned by the caller of the method.

`num_colors`

  Type: `gint*`

  The number of colors in the palette.

  The argument will be set by the function.
  The argument can be set to `NULL` by the method.

`num_bytes`

  Type: `gsize*`

  The byte-size of the returned value.

  The argument will be set by the function.
  The argument can be set to `NULL` by the method.

#### Return value

Type: An array of `guint8`

The palette’s colormap.

The length of the array is in the `num_bytes` argument.
The caller of the method takes ownership of the returned data, and is responsible for freeing it.