Class

PurpleImage

unstable since: 3.0

Description [src]

class Purple.Image : GObject.Object
{
  /* No available fields */
}

PurpleImage object is a container for raw image data. It doesn’t manipulate image data, just stores it in its binary format - png, jpeg etc. Thus, it’s totally independent from the UI.

This class also provides certain file-related features, like: friendly filenames (not necessarily real filename for displaying); remote images (which data is not yet loaded) or guessing file format from its header.

Available since: 3.0

Ancestors

Constructors

purple_image_new_from_bytes

Loads a raw image data as a new PurpleImage object.

unstable since: 3.0

purple_image_new_from_data

Creates a new PurpleImage object with contents of data buffer.

unstable since: 3.0

purple_image_new_from_file

Loads an image file as a new PurpleImage object. The path must exists, be readable and should point to a valid image file. If you don’t set be_eager parameter, there will be a risk that file will be removed from disk before you access its data.

unstable since: 3.0

purple_image_new_take_data

Creates a new PurpleImage object with contents of data buffer.

unstable since: 3.0

Instance methods

purple_image_generate_filename

Calculates almost-unique filename by computing checksum from file contents and appending a suitable extension. You should not assume the checksum is SHA-1, because it may change in the future.

unstable since: 3.0

purple_image_get_contents

Returns a new reference to the GBytes that contains the image data.

unstable since: 3.0

purple_image_get_data

Returns the pointer to the buffer containing image data.

unstable since: 3.0

purple_image_get_data_size

Returns the size of images data.

unstable since: 3.0

purple_image_get_extension

Guesses the image format based on its contents.

unstable since: 3.0

purple_image_get_friendly_filename

Returns the “friendly filename” for the image, to be displayed or used as a default name when saving a file to the disk. See #purple_image_set_friendly_filename.

unstable since: 3.0

purple_image_get_mimetype

Guesses the image mime-type based on its contents.

unstable since: 3.0

purple_image_get_path

Returns the physical path of the image file. It is set only, if the image is really backed by an existing file. In the other case it returns NULL.

unstable since: 3.0

purple_image_save

Saves an image to the disk.

unstable since: 3.0

purple_image_set_friendly_filename

Sets the “friendly filename” for the image. This don’t have to be a real name, because it’s used for displaying or as a default file name when the user wants to save the image to the disk.

unstable since: 3.0

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Purple.Image:contents

The contents of the image.

unstable since: 3.0

Purple.Image:path

The file path for the image if one was provided.

unstable since: 3.0

Purple.Image:size

The size of the image in bytes.

unstable since: 3.0

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct PurpleImageClass {
  void (* purple_reserved1) (
void
  );
  void (* purple_reserved2) (
void
  );
  void (* purple_reserved3) (
void
  );
  void (* purple_reserved4) (
void
  );
  
}

No description available.

Class members
purple_reserved1: void (* purple_reserved1) ( void )

No description available.

purple_reserved2: void (* purple_reserved2) ( void )

No description available.

purple_reserved3: void (* purple_reserved3) ( void )

No description available.

purple_reserved4: void (* purple_reserved4) ( void )

No description available.