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.

copy()

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

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.

Warning

do not resize or delete the object while using the view.

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.

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.

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:

list of (str, value) tuple

Returns:

structure member (name, value) pairs (with any trailing underscores removed from names).

keys()

Get structure member names.

Return type:

list of str

Returns:

structure member names (with any trailing underscores removed).

mimeType_

Preview image mime type.

size_

Preview image size in bytes.

values()

Get structure member values.

Return type:

list of value

Returns:

structure member values.

width_

Preview image width in pixels or 0 for unknown width.