exiv2.preview

Access to preview images.

For Exif thumbnail images see the ExifThumb class.

Classes

PreviewImage

Class that holds preview image properties and data buffer.

PreviewManager

Class for extracting preview images from image metadata.

PreviewProperties

Preview image properties.

class PreviewImage

Bases: SwigPyObject

Class that holds preview image properties and data buffer.

__annotations__ = {}
__len__()

Return len(self).

copy()

Return a copy of the preview image data. The caller owns this copy and DataBuf ensures that it will be deleted.

data()

Returns a temporary Python memoryview of the object’s data.

Return type:

memoryview

extension()

Return the file extension for the format of the preview image (“.tif” or “.jpg”).

height()

Return the height of the preview image in pixels.

id()

Return the preview image type identifier.

mimeType()

Return the MIME type of the preview image, usually either "image/tiff" or "image/jpeg".

pData()

Returns a temporary Python memoryview of the object’s data.

Return type:

memoryview

size()

Return the size of the preview image in bytes.

width()

Return the width of the preview image in pixels.

writeFile()

Write the thumbnail image to a file.

A filename extension is appended to path according to the image type of the preview image, so path should not include an extension. The function will overwrite an existing file of the same name.

Parameters:

path (str) – File name of the preview image without extension.

Return type:

int

Returns:

The number of bytes written.

class PreviewManager

Bases: SwigPyObject

Class for extracting preview images from image metadata.

__annotations__ = {}
getPreviewImage()

Return the preview image for the given preview properties.

getPreviewProperties()

Return the properties of all preview images in a list sorted by preview width * height, starting with the smallest preview image.

class PreviewProperties

Bases: SwigPyObject

Preview image properties.

__annotations__ = {}
__getitem__(key, /)

Return self[key].

__iter__()

Implement iter(self).

extension_

Preview image extension.

height_

Preview image height in pixels or 0 for unknown height.

id_

Identifies type of preview image.

items()

Get structure members.

Return type:

tuple of (str, value) tuple

Returns:

structure member (name, value) pairs.

static keys()

Get structure member names.

Return the names used to access members as attributes (object.name) or with dict-like indexing (object['name']). Attribute access is preferred as it is more efficient.

Although the exiv2 C++ structure member names end with underscores, the Python interface uses names without underscores.

Return type:

tuple of str

Returns:

structure member names.

mimeType_

Preview image mime type.

size_

Preview image size in bytes.

values()

Get structure member values.

Return type:

tuple of value

Returns:

structure member values.

width_

Preview image width in pixels or 0 for unknown width.