## Preview images

Preview images — Class describing preview images (or thumbnails) that are part of the metadata.

## Functions

void | gexiv2_preview_image_free ()
const guint8 * | gexiv2_preview_image_get_data ()
const gchar * | gexiv2_preview_image_get_mime_type ()
const gchar * | gexiv2_preview_image_get_extension ()
guint32 | gexiv2_preview_image_get_width ()
guint32 | gexiv2_preview_image_get_height ()
glong | gexiv2_preview_image_try_write_file ()
glong | gexiv2_preview_image_write_file ()

## Object Hierarchy

        GObject
        ╰── GExiv2PreviewImage

## Includes

    #include <gexiv2/gexiv2.h>

## Description

GExiv2PreviewImage is an accessor to the preview images contained in the image's metadata. This could be anything from a thumbnail to a full-sized camera development of a RAW image.

The GExiv2PreviewImage is obtained by calling `gexiv2_metadata_get_preview_image()` with an instance of GExiv2PreviewProperties that are describing the image to be fetched.

    1
    2
    3
    4
    5
    6
    7
    GExiv2PreviewProperties **properties, **it;
    properties = it = gexiv2_metadata_get_preview_properties(metadata);

    while (*it) {
      preview_image = gexiv2_metadata_get_preview_image(metadata, *it);
      it++;
    }

## Functions

### gexiv2_preview_image_free ()

    void
    gexiv2_preview_image_free (GExiv2PreviewImage *self);

`gexiv2_preview_image_free` has been deprecated since version 0.10.3 and should not be used in newly-written code.

Use `g_object_unref()` instead.

Releases the preview image and all associated memory.

#### Parameters

self | An instance of GExiv2PreviewImage |

### gexiv2_preview_image_get_data ()

    const guint8 *
    gexiv2_preview_image_get_data (GExiv2PreviewImage *self,
                                   guint32 *size);

#### Parameters

self | An instance of GExiv2PreviewImage |
size | The size of the buffer holding the data. | [out][skip]

#### Returns

The raw image data.

[transfer none][array length=size]

### gexiv2_preview_image_get_mime_type ()

    const gchar *
    gexiv2_preview_image_get_mime_type (GExiv2PreviewImage *self);

#### Parameters

self | An instance of GExiv2PreviewImage |

#### Returns

The preview image's MIME type.

[transfer none]

### gexiv2_preview_image_get_extension ()

    const gchar *
    gexiv2_preview_image_get_extension (GExiv2PreviewImage *self);

#### Parameters

self | An instance of GExiv2PreviewImage |

#### Returns

The preview image's recommended file extension.

[transfer none]

### gexiv2_preview_image_get_width ()

    guint32
    gexiv2_preview_image_get_width (GExiv2PreviewImage *self);

#### Parameters

self | An instance of GExiv2PreviewImage |

#### Returns

The preview image's display width in pixels.

### gexiv2_preview_image_get_height ()

    guint32
    gexiv2_preview_image_get_height (GExiv2PreviewImage *self);

#### Parameters

self | An instance of GExiv2PreviewImage |

#### Returns

The preview image's display height in pixels.

### gexiv2_preview_image_try_write_file ()

    glong
    gexiv2_preview_image_try_write_file (GExiv2PreviewImage *self,
                                         const gchar *path,
                                         GError **error);

#### Parameters

self | An instance of GExiv2PreviewImage |
path | The file path to write the preview image to. | [in]
error | A return location for a GError or `NULL`. | [allow-none]

#### Returns

The number of bytes written to the file.

Since: 0.14.0

### gexiv2_preview_image_write_file ()

    glong
    gexiv2_preview_image_write_file (GExiv2PreviewImage *self,
                                     const gchar *path);

`gexiv2_preview_image_write_file` has been deprecated since version 0.14.0 and should not be used in newly-written code.

Use `gexiv2_preview_image_try_write_file()` instead.

#### Parameters

self | An instance of GExiv2PreviewImage |
path | The file path to write the preview image to. | [in]

#### Returns

The number of bytes written to the file.

## See Also

GExiv2Metadata GExiv2PreviewProperties