## AsImage AsImage — Object representing a single image used in a screenshot. |

## Stability Level

Stable, unless otherwise indicated

## Functions

AsImage * | as_image_new ()
AsImageKind | as_image_kind_from_string ()
const gchar * | as_image_kind_to_string ()
const gchar * | as_image_get_url ()
const gchar * | as_image_get_md5 ()
const gchar * | as_image_get_basename ()
const gchar * | as_image_get_locale ()
guint | as_image_get_width ()
guint | as_image_get_height ()
AsImageKind | as_image_get_kind ()
GdkPixbuf * | as_image_get_pixbuf ()
void | as_image_set_url ()
void | as_image_set_basename ()
void | as_image_set_locale ()
void | as_image_set_width ()
void | as_image_set_height ()
void | as_image_set_kind ()
void | as_image_set_pixbuf ()
AsImageAlphaFlags | as_image_get_alpha_flags ()
gboolean | as_image_load_filename ()
gboolean | as_image_load_filename_full ()
GdkPixbuf * | as_image_save_pixbuf ()
gboolean | as_image_save_filename ()
gboolean | as_image_equal ()

## Types and Values

#define | AS_TYPE_IMAGE
struct | AsImageClass
enum | AsImageKind
enum | AsImageSaveFlags
enum | AsImageLoadFlags
#define | AS_IMAGE_ALPHA_FLAG_NONE
#define | AS_IMAGE_ALPHA_FLAG_TOP
#define | AS_IMAGE_ALPHA_FLAG_BOTTOM
#define | AS_IMAGE_ALPHA_FLAG_LEFT
#define | AS_IMAGE_ALPHA_FLAG_RIGHT
#define | AS_IMAGE_ALPHA_FLAG_INTERNAL
typedef | AsImageAlphaFlags
#define | AS_IMAGE_LARGE_HEIGHT
#define | AS_IMAGE_LARGE_WIDTH
#define | AS_IMAGE_NORMAL_HEIGHT
#define | AS_IMAGE_NORMAL_WIDTH
#define | AS_IMAGE_THUMBNAIL_HEIGHT
#define | AS_IMAGE_THUMBNAIL_WIDTH
| AsImage

## Includes

    #include <appstream-glib.h>

## Description

Screenshot may have multiple versions of an image in different resolutions or aspect ratios. This object allows access to the location and size of a single image.

See also: AsScreenshot

## Functions

### as_image_new ()

    AsImage *
    as_image_new (void);

Creates a new AsImage.

#### Returns

a AsImage.

[transfer full]

Since: 0.1.0

### as_image_kind_from_string ()

    AsImageKind
    as_image_kind_from_string (const gchar *kind);

Converts the text representation to an enumerated value.

#### Parameters

kind | the string. |

#### Returns

a AsImageKind, or `AS_IMAGE_KIND_UNKNOWN` for unknown.

[transfer full]

Since: 0.1.0

### as_image_kind_to_string ()

    const gchar *
    as_image_kind_to_string (AsImageKind kind);

Converts the enumerated value to an text representation.

#### Parameters

kind | the AsImageKind. |

#### Returns

string version of `kind`

Since: 0.1.0

### as_image_get_url ()

    const gchar *
    as_image_get_url (AsImage *image);

Gets the full qualified URL for the image, usually pointing at some mirror.

#### Parameters

image | a AsImage instance. |

#### Returns

URL

Since: 0.1.0

### as_image_get_md5 ()

    const gchar *
    as_image_get_md5 (AsImage *image);

Gets the string representation of the pixbuf hash value.

#### Parameters

image | a AsImage instance. |

#### Returns

string representing the MD5 sum, or `NULL` if unset

Since: 0.1.6

### as_image_get_basename ()

    const gchar *
    as_image_get_basename (AsImage *image);

Gets the suggested basename the image, including file extension.

#### Parameters

image | a AsImage instance. |

#### Returns

filename

Since: 0.1.6

### as_image_get_locale ()

    const gchar *
    as_image_get_locale (AsImage *image);

Gets the locale of the image.

#### Parameters

image | a AsImage instance. |

#### Returns

locale, or `NULL`

Since: 0.5.14

### as_image_get_width ()

    guint
    as_image_get_width (AsImage *image);

Gets the image width.

#### Parameters

image | a AsImage instance. |

#### Returns

width in pixels

Since: 0.1.0

### as_image_get_height ()

    guint
    as_image_get_height (AsImage *image);

Gets the image height.

#### Parameters

image | a AsImage instance. |

#### Returns

height in pixels

Since: 0.1.0

### as_image_get_kind ()

    AsImageKind
    as_image_get_kind (AsImage *image);

Gets the image kind.

#### Parameters

image | a AsImage instance. |

#### Returns

the AsImageKind

Since: 0.1.0

### as_image_get_pixbuf ()

    GdkPixbuf *
    as_image_get_pixbuf (AsImage *image);

Gets the image pixbuf if set.

#### Parameters

image | a AsImage instance. |

#### Returns

the GdkPixbuf, or `NULL`.

[transfer none]

Since: 0.1.6

### as_image_set_url ()

    void
    as_image_set_url (AsImage *image,
                      const gchar *url);

Sets the fully-qualified mirror URL to use for the image.

#### Parameters

image | a AsImage instance. |
url | the URL. |

Since: 0.1.0

### as_image_set_basename ()

    void
    as_image_set_basename (AsImage *image,
                           const gchar *basename);

Sets the image basename filename.

#### Parameters

image | a AsImage instance. |
basename | the new filename basename. |

Since: 0.1.6

### as_image_set_locale ()

    void
    as_image_set_locale (AsImage *image,
                         const gchar *locale);

Sets the image locale.

#### Parameters

image | a AsImage instance. |
locale | the new image locale, e.g. "en_GB" or `NULL`. |

Since: 0.5.14

### as_image_set_width ()

    void
    as_image_set_width (AsImage *image,
                        guint width);

Sets the image width.

#### Parameters

image | a AsImage instance. |
width | the width in pixels. |

Since: 0.1.0

### as_image_set_height ()

    void
    as_image_set_height (AsImage *image,
                         guint height);

Sets the image height.

#### Parameters

image | a AsImage instance. |
height | the height in pixels. |

Since: 0.1.0

### as_image_set_kind ()

    void
    as_image_set_kind (AsImage *image,
                       AsImageKind kind);

Sets the image kind.

#### Parameters

image | a AsImage instance. |
kind | the AsImageKind, e.g. `AS_IMAGE_KIND_THUMBNAIL`. |

Since: 0.1.0

### as_image_set_pixbuf ()

    void
    as_image_set_pixbuf (AsImage *image,
                         GdkPixbuf *pixbuf);

Sets the image pixbuf.

#### Parameters

image | a AsImage instance. |
pixbuf | the GdkPixbuf, or `NULL` |

Since: 0.1.6

### as_image_get_alpha_flags ()

    AsImageAlphaFlags
    as_image_get_alpha_flags (AsImage *image);

Gets the alpha flags for the image. The following image would have all flags set, where 'x' is alpha and '@' is non-alpha.

xxxxxxxxxxxxxxxxxxxxxxxxxxxx xx@@@@@@@@@@@@@@@@@@@@@@@`xx` xx@@@@@@`xxxxxx` @@@@@@@@@@`xx` xx@@@@@@`xxxxxx` @@@@@@@@@@`xx` xx@@@@@@@@@@@@@@@@@@@@@@@`xx` xxxxxxxxxxxxxxxxxxxxxxxxxxxx

[skip]

#### Parameters

image | a AsImage instance. |

#### Returns

AsImageAlphaFlags, e.g. `AS_IMAGE_ALPHA_FLAG_LEFT`

Since: 0.2.2

### as_image_load_filename ()

    gboolean
    as_image_load_filename (AsImage *image,
                            const gchar *filename,
                            GError **error);

Reads a pixbuf from a file.

NOTE: This function also sets the suggested filename which can be retrieved using `as_image_get_basename()`. This can be overridden if required.

#### Parameters

image | a AsImage instance. |
filename | filename to read from |
error | A GError or `NULL`. |

#### Returns

`TRUE` for success

Since: 0.1.6

### as_image_load_filename_full ()

    gboolean
    as_image_load_filename_full (AsImage *image,
                                 const gchar *filename,
                                 guint dest_size,
                                 guint src_size_min,
                                 AsImageLoadFlags flags,
                                 GError **error);

Reads an image from a file.

#### Parameters

image | a AsImage instance. |
filename | filename to read from |
dest_size | The size of the constructed pixbuf, or 0 for the native size |
src_size_min | The smallest source size allowed, or 0 for none |
flags | a AsImageLoadFlags, e.g. `AS_IMAGE_LOAD_FLAG_NONE` |
error | A GError or `NULL`. |

#### Returns

`TRUE` for success

Since: 0.5.6

### as_image_save_pixbuf ()

    GdkPixbuf *
    as_image_save_pixbuf (AsImage *image,
                          guint width,
                          guint height,
                          AsImageSaveFlags flags);

Resamples a pixbuf to a specific size.

#### Parameters

image | a AsImage instance. |
width | target width, or 0 for default |
height | target height, or 0 for default |
flags | some AsImageSaveFlags values, e.g. `AS_IMAGE_SAVE_FLAG_PAD_16_9` |

#### Returns

A GdkPixbuf of the specified size.

[transfer full]

Since: 0.1.6

### as_image_save_filename ()

    gboolean
    as_image_save_filename (AsImage *image,
                            const gchar *filename,
                            guint width,
                            guint height,
                            AsImageSaveFlags flags,
                            GError **error);

Saves a pixbuf to a file.

#### Parameters

image | a AsImage instance. |
filename | filename to write to |
width | target width, or 0 for default |
height | target height, or 0 for default |
flags | some AsImageSaveFlags values, e.g. `AS_IMAGE_SAVE_FLAG_PAD_16_9` |
error | A GError or `NULL`. |

#### Returns

`TRUE` for success

Since: 0.1.6

### as_image_equal ()

    gboolean
    as_image_equal (AsImage *image1,
                    AsImage *image2);

Checks if two images are the same.

#### Parameters

image1 | a AsImage instance. |
image2 | a AsImage instance. |

#### Returns

`TRUE` for success

Since: 0.5.7

## Types and Values

### AS_TYPE_IMAGE

    #define AS_TYPE_IMAGE (as_image_get_type ())

### struct AsImageClass

    struct AsImageClass {
    	GObjectClass		parent_class;
    };

### enum AsImageKind

The image type.

#### Members

AS_IMAGE_KIND_UNKNOWN | Type invalid or not known |
AS_IMAGE_KIND_SOURCE | The source image at full resolution |
AS_IMAGE_KIND_THUMBNAIL | A thumbnail at reduced resolution |

### enum AsImageSaveFlags

The flags used for saving images.

#### Members

AS_IMAGE_SAVE_FLAG_NONE | No special flags set |
AS_IMAGE_SAVE_FLAG_PAD_16_9 | Pad with alpha to 16:9 aspect |
AS_IMAGE_SAVE_FLAG_SHARPEN | Sharpen the image to clarify detail |
AS_IMAGE_SAVE_FLAG_BLUR | Blur the image to clear detail |

### enum AsImageLoadFlags

The flags used for loading images.

#### Members

AS_IMAGE_LOAD_FLAG_NONE | No special flags set |
AS_IMAGE_LOAD_FLAG_SHARPEN | Sharpen the resulting image |
AS_IMAGE_LOAD_FLAG_SET_BASENAME | Set the image basename |
AS_IMAGE_LOAD_FLAG_SET_CHECKSUM | Set the image checksum |
AS_IMAGE_LOAD_FLAG_ONLY_SUPPORTED | Only load supported formats like PNG and JPG |
AS_IMAGE_LOAD_FLAG_ALWAYS_RESIZE | Always resize the source icon to the perfect size |

### AS_IMAGE_ALPHA_FLAG_NONE

    #define AS_IMAGE_ALPHA_FLAG_NONE (0u)		/* Since: 0.2.2 */

### AS_IMAGE_ALPHA_FLAG_TOP

    #define AS_IMAGE_ALPHA_FLAG_TOP		(1u << 0) /* Since: 0.2.2 */

### AS_IMAGE_ALPHA_FLAG_BOTTOM

    #define AS_IMAGE_ALPHA_FLAG_BOTTOM (1u << 1) /* Since: 0.2.2 */

### AS_IMAGE_ALPHA_FLAG_LEFT

    #define AS_IMAGE_ALPHA_FLAG_LEFT (1u << 2) /* Since: 0.2.2 */

### AS_IMAGE_ALPHA_FLAG_RIGHT

    #define AS_IMAGE_ALPHA_FLAG_RIGHT (1u << 3) /* Since: 0.2.2 */

### AS_IMAGE_ALPHA_FLAG_INTERNAL

    #define AS_IMAGE_ALPHA_FLAG_INTERNAL (1u << 4) /* Since: 0.2.2 */

### AsImageAlphaFlags

    typedef guint AsImageAlphaFlags;

The flags used for reporting the alpha cutouts in the image.

### AS_IMAGE_LARGE_HEIGHT

    #define AS_IMAGE_LARGE_HEIGHT		423 /* Since: 0.2.2 */

### AS_IMAGE_LARGE_WIDTH

    #define AS_IMAGE_LARGE_WIDTH		752 /* Since: 0.2.2 */

### AS_IMAGE_NORMAL_HEIGHT

    #define AS_IMAGE_NORMAL_HEIGHT		351 /* Since: 0.2.2 */

### AS_IMAGE_NORMAL_WIDTH

    #define AS_IMAGE_NORMAL_WIDTH		624 /* Since: 0.2.2 */

### AS_IMAGE_THUMBNAIL_HEIGHT

    #define AS_IMAGE_THUMBNAIL_HEIGHT 63 /* Since: 0.2.2 */

### AS_IMAGE_THUMBNAIL_WIDTH

    #define AS_IMAGE_THUMBNAIL_WIDTH 	112 /* Since: 0.2.2 */

### AsImage

    typedef struct _AsImage AsImage;