Class: QgsExifTools

Contains utilities for working with EXIF tags in images.

Added in version 3.6.

class qgis.analysis.QgsExifTools

Bases: object

class GeoTagDetails

Bases: object

Extended image geotag details.

Added in version 3.6.

elevation: float
static geoTagImage(imagePath: str | None, location: QgsPointXY, details: QgsExifTools.GeoTagDetails = QgsExifTools.GeoTagDetails()) bool

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)

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

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

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]

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

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.