Class: QgsExifTools

Contains utilities for working with EXIF tags in images.

Added in version 3.6.

Static Methods

geoTagImage

Writes geotags to the image at imagePath.

getGeoTag

Returns the geotagged coordinate stored in the image at imagePath.

hasGeoTag

Returns True if the image at imagePath contains a valid geotag.

readTag

Returns the value of of an exif tag key stored in the image at imagePath.

readTags

Returns a map object containing all exif tags stored in the image at imagePath.

tagImage

Writes a tag to the image at imagePath.

class qgis.core.QgsExifTools[source]

Bases: object

class GeoTagDetails[source]

Bases: object

Extended image geotag details.

Added in version 3.6.

elevation: float

GPS elevation, or NaN if elevation is not available.

static geoTagImage(imagePath: str | None, location: QgsPointXY, details: QgsExifTools.GeoTagDetails = QgsExifTools.GeoTagDetails()) bool[source]

Writes geotags to the image at imagePath.

The location argument indicates the GPS location to write to the image, as a WGS84 latitude/longitude coordinate.

If desired, extended GPS tags (such as elevation) can be specified via the details argument.

Returns True if writing was successful.

See also

getGeoTag()

Parameters:
  • imagePath (Optional[str])

  • location (QgsPointXY)

  • details (QgsExifTools.GeoTagDetails = QgsExifTools.GeoTagDetails())

Return type:

bool

static getGeoTag(imagePath: str | None)[source]

Returns the geotagged coordinate stored in the image at imagePath.

If a geotag was found, ok will be set to True.

If the image contains an elevation tag then the returned point will contain the elevation as a z value.

See also

geoTagImage()

Parameters:

imagePath (Optional[str]) -> (QgsPoint)

static hasGeoTag(imagePath: str | None) bool[source]

Returns True if the image at imagePath contains a valid geotag.

See also

getGeoTag()

Parameters:

imagePath (Optional[str])

Return type:

bool

static readTag(imagePath: str | None, key: str | None) Any[source]

Returns the value of of an exif tag key stored in the image at imagePath.

Added in version 3.22.

Parameters:
  • imagePath (Optional[str])

  • key (Optional[str])

Return type:

Any

static readTags(imagePath: str | None) Dict[str, Any][source]

Returns a map object containing all exif tags stored in the image at imagePath.

Added in version 3.22.

Parameters:

imagePath (Optional[str])

Return type:

Dict[str, Any]

static tagImage(imagePath: str | None, tag: str | None, value: Any) bool[source]

Writes a tag to the image at imagePath.

Parameters:
  • imagePath (Optional[str]) – the image path

  • tag (Optional[str]) – the exif tag name

  • value (Any) – the exif tag value

Return type:

bool

Returns:

True if writing was successful.

Added in version 3.30.