SpatiaLite  4.2.0
 All Data Structures Files Functions Variables Typedefs Macros Pages
Data Structures | Macros | Typedefs | Functions
gaiaexif.h File Reference

EXIF/image: supporting functions and constants. More...

Go to the source code of this file.

Data Structures

struct  gaiaExifTagStruct
 Container for an EXIF tag. More...
 
struct  gaiaExifTagListStruct
 Container for a list of EXIF tags. More...
 

Macros

#define GAIA_HEX_BLOB   0
 generic hexadecimal BLOB
 
#define GAIA_GIF_BLOB   1
 this BLOB does actually contain a GIF image
 
#define GAIA_PNG_BLOB   2
 this BLOB does actually containt a PNG image
 
#define GAIA_JPEG_BLOB   3
 this BLOB does actually contain a generic JPEG image
 
#define GAIA_EXIF_BLOB   4
 this BLOB does actually contain a JPEG-EXIF image
 
#define GAIA_EXIF_GPS_BLOB   5
 this BLOB does actually contain a JPEG-EXIF image including GPS data
 
#define GAIA_ZIP_BLOB   6
 this BLOB does actually contain a ZIP compressed file
 
#define GAIA_PDF_BLOB   7
 this BLOB does actually contain a PDF document
 
#define GAIA_GEOMETRY_BLOB   8
 this BLOB does actually contain a SpatiaLite Geometry
 
#define GAIA_TIFF_BLOB   9
 this BLOB does actually contain a TIFF image
 
#define GAIA_WEBP_BLOB   10
 this BLOB does actually contain a WebP image
 
#define GAIA_XML_BLOB   11
 this BLOB does actually contain a SpatiaLite XmlBLOB
 
#define GAIA_GPB_BLOB   12
 this BLOB does actually contain a GPKG Geometry
 
#define GAIA_EXIF_NONE   0
 unrecognized EXIF value
 
#define GAIA_EXIF_BYTE   1
 EXIF value of the BYTE type.
 
#define GAIA_EXIF_SHORT   2
 EXIF value of the SHORT type.
 
#define GAIA_EXIF_STRING   3
 EXIF value of the STRING type.
 
#define GAIA_EXIF_LONG   4
 EXIF value of the LONG type.
 
#define GAIA_EXIF_RATIONAL   5
 EXIF value of the RATIONAL type.
 
#define GAIA_EXIF_SLONG   9
 EXIF value of the SLONG type.
 
#define GAIA_EXIF_SRATIONAL   10
 EXIF value of the SRATIONAL type.
 

Typedefs

typedef struct gaiaExifTagStruct gaiaExifTag
 Container for an EXIF tag.
 
typedef gaiaExifTaggaiaExifTagPtr
 Typedef for EXIF tag structure. More...
 
typedef struct
gaiaExifTagListStruct 
gaiaExifTagList
 Container for a list of EXIF tags.
 
typedef gaiaExifTagListgaiaExifTagListPtr
 Typedef for EXIF tag structure. More...
 

Functions

GAIAEXIF_DECLARE gaiaExifTagListPtr gaiaGetExifTags (const unsigned char *blob, int size)
 Creates a list of EXIF tags by parsing a BLOB of the JPEG-EXIF type. More...
 
GAIAEXIF_DECLARE void gaiaExifTagsFree (gaiaExifTagListPtr tag_list)
 Destroy a list of EXIF tags. More...
 
GAIAEXIF_DECLARE int gaiaGetExifTagsCount (gaiaExifTagListPtr tag_list)
 Return the total number of EXIF tags into the list. More...
 
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByPos (gaiaExifTagListPtr tag_list, const int pos)
 Retrieves an EXIF tag by its relative position into the list. More...
 
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagById (const gaiaExifTagListPtr tag_list, const unsigned short tag_id)
 Retrieves an EXIF tag by its Tag ID. More...
 
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifGpsTagById (const gaiaExifTagListPtr tag_list, const unsigned short tag_id)
 Retrieves an EXIF-GPS tag by its Tag ID. More...
 
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByName (const gaiaExifTagListPtr tag_list, const char *tag_name)
 Retrieves an EXIF tag by its name. More...
 
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetId (const gaiaExifTagPtr tag)
 Return the Tag ID from an EXIF tag. More...
 
GAIAEXIF_DECLARE void gaiaExifTagGetName (const gaiaExifTagPtr tag, char *tag_name, int len)
 Return the Tag Name from an EXIF tag. More...
 
GAIAEXIF_DECLARE int gaiaIsExifGpsTag (const gaiaExifTagPtr tag)
 Checks if an EXIF tag actually is an EXIF-GPS tag. More...
 
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetValueType (const gaiaExifTagPtr tag)
 Return the value type for an EXIF tag. More...
 
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetNumValues (const gaiaExifTagPtr tag)
 Return the total count of values from an EXIF tag. More...
 
GAIAEXIF_DECLARE unsigned char gaiaExifTagGetByteValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a BYTE value from an EXIF tag. More...
 
GAIAEXIF_DECLARE void gaiaExifTagGetStringValue (const gaiaExifTagPtr tag, char *str, int len, int *ok)
 Return a STRING value from an EXIF tag. More...
 
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetShortValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a SHORT value from an EXIF tag. More...
 
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetLongValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a LONG value from an EXIF tag. More...
 
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational1Value (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a RATIONAL [numerator] value from an EXIF tag. More...
 
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational2Value (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a RATIONAL [denominator] value from an EXIF tag. More...
 
GAIAEXIF_DECLARE double gaiaExifTagGetRationalValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a RATIONAL value from an EXIF tag. More...
 
GAIAEXIF_DECLARE short gaiaExifTagGetSignedShortValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a Signed SHORT value from an EXIF tag. More...
 
GAIAEXIF_DECLARE int gaiaExifTagGetSignedLongValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a Signed LONG value from an EXIF tag. More...
 
GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational1Value (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a SRATIONAL [numerator] value from an EXIF tag. More...
 
GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational2Value (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a SRATIONAL [denominator] value from an EXIF tag. More...
 
GAIAEXIF_DECLARE double gaiaExifTagGetSignedRationalValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a Signed RATIONAL value from an EXIF tag. More...
 
GAIAEXIF_DECLARE float gaiaExifTagGetFloatValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a FLOAT value from an EXIF tag. More...
 
GAIAEXIF_DECLARE double gaiaExifTagGetDoubleValue (const gaiaExifTagPtr tag, const int ind, int *ok)
 Return a DOUBLE value from an EXIF tag. More...
 
GAIAEXIF_DECLARE void gaiaExifTagGetHumanReadable (const gaiaExifTagPtr tag, char *str, int len, int *ok)
 Return a human readable description from an EXIF tag. More...
 
GAIAEXIF_DECLARE int gaiaGuessBlobType (const unsigned char *blob, int size)
 Attempts to guess the actual content-type of some BLOB. More...
 
GAIAEXIF_DECLARE int gaiaGetGpsCoords (const unsigned char *blob, int size, double *longitude, double *latitude)
 Return longitude and latitude from an EXIF-GPS tag. More...
 
GAIAEXIF_DECLARE int gaiaGetGpsLatLong (const unsigned char *blob, int size, char *latlong, int ll_size)
 Return a text string representing DMS coordinates from an EXIF-GPS tag. More...
 

Detailed Description

EXIF/image: supporting functions and constants.

Typedef Documentation

Typedef for EXIF tag structure.

See Also
gaiaExifTagListStruct

Typedef for EXIF tag structure.

See Also
gaiaExifTagStruct

Function Documentation

GAIAEXIF_DECLARE unsigned char gaiaExifTagGetByteValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a BYTE value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the BYTE value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE double gaiaExifTagGetDoubleValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a DOUBLE value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the DOUBLE value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE float gaiaExifTagGetFloatValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a FLOAT value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the FLOAT value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE void gaiaExifTagGetHumanReadable ( const gaiaExifTagPtr  tag,
char *  str,
int  len,
int *  ok 
)

Return a human readable description from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
strreceiving buffer: the STRING value will be copied here.
lenlength of the receiving buffer
okon completion will contain 0 on failure: any other value on success.
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetId ( const gaiaExifTagPtr  tag)

Return the Tag ID from an EXIF tag.

Parameters
tagpointer to an EXIF tag
Returns
the Tag ID
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetLongValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a LONG value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the LONG value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE void gaiaExifTagGetName ( const gaiaExifTagPtr  tag,
char *  tag_name,
int  len 
)

Return the Tag Name from an EXIF tag.

Parameters
tagpointer to an EXIF tag
tag_namereceiving buffer: the Tag Name will be copied here
lenlength of the receiving buffer
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetNumValues ( const gaiaExifTagPtr  tag)

Return the total count of values from an EXIF tag.

Parameters
tagpointer to an EXIF tag
Returns
the number of available values
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational1Value ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a RATIONAL [numerator] value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the RATIONAL [numerator] value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational2Value ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a RATIONAL [denominator] value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the RATIONAL [denominator] value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE double gaiaExifTagGetRationalValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a RATIONAL value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the RATIONAL value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetShortValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a SHORT value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the SHORT value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE int gaiaExifTagGetSignedLongValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a Signed LONG value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the Signed LONG value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational1Value ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a SRATIONAL [numerator] value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the SRATIONAL [numerator] value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational2Value ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a SRATIONAL [denominator] value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the SRATIONAL [denominator] value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE double gaiaExifTagGetSignedRationalValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a Signed RATIONAL value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the Signed RATIONAL value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE short gaiaExifTagGetSignedShortValue ( const gaiaExifTagPtr  tag,
const int  ind,
int *  ok 
)

Return a Signed SHORT value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
indvalue index [first value has index 0].
okon completion will contain 0 on failure: any other value on success.
Returns
the Signed SHORT value
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE void gaiaExifTagGetStringValue ( const gaiaExifTagPtr  tag,
char *  str,
int  len,
int *  ok 
)

Return a STRING value from an EXIF tag.

Parameters
tagpointer to an EXIF tag.
strreceiving buffer: the STRING value will be copied here.
lenlength of the receiving buffer
okon completion will contain 0 on failure: any other value on success.
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaExifTagGetValueType, gaiaExifTagGetNumValues
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetValueType ( const gaiaExifTagPtr  tag)

Return the value type for an EXIF tag.

Parameters
tagpointer to an EXIF tag
Returns
the value type: one of GAIA_EXIF_NONE, GAIA_EXIF_BYTE, GAIA_EXIF_SHORT, GAIA_EXIF_STRING, GAIA_EXIF_LONG, GAIA_EXIF_RATIONAL, GAIA_EXIF_SLONG, GAIA_EXIF_SRATIONAL
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName
GAIAEXIF_DECLARE void gaiaExifTagsFree ( gaiaExifTagListPtr  tag_list)

Destroy a list of EXIF tags.

Parameters
tag_listthe list to be destroied
See Also
gaiaGetExifTags
Note
the pointer passed to this function must be one returned by a previous call to gaiaGetExifTags
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifGpsTagById ( const gaiaExifTagListPtr  tag_list,
const unsigned short  tag_id 
)

Retrieves an EXIF-GPS tag by its Tag ID.

Parameters
tag_listpointer to an EXIF tag list.
tag_idthe GPS Tag ID to be found
Returns
a pointer to the corresponding EXIF tag: NULL if not found
See Also
gaiaGetExifTags, gaiaExifTagsFree
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagById ( const gaiaExifTagListPtr  tag_list,
const unsigned short  tag_id 
)

Retrieves an EXIF tag by its Tag ID.

Parameters
tag_listpointer to an EXIF tag list.
tag_idthe Tag ID to be found
Returns
a pointer to the corresponding EXIF tag: NULL if not found
See Also
gaiaGetExifTags, gaiaExifTagsFree
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByName ( const gaiaExifTagListPtr  tag_list,
const char *  tag_name 
)

Retrieves an EXIF tag by its name.

Parameters
tag_listpointer to an EXIF tag list.
tag_namethe Tag Name to be found
Returns
a pointer to the corresponding EXIF tag: NULL if not found
See Also
gaiaGetExifTags, gaiaExifTagsFree
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByPos ( gaiaExifTagListPtr  tag_list,
const int  pos 
)

Retrieves an EXIF tag by its relative position into the list.

Parameters
tag_listpointer to an EXIF tag list.
posrelative item position [first item is 0]
Returns
a pointer to the corresponding EXIF tag: NULL if not found
See Also
gaiaGetExifTags, gaiaExifTagsFree, gaiaExifTagsCount
GAIAEXIF_DECLARE gaiaExifTagListPtr gaiaGetExifTags ( const unsigned char *  blob,
int  size 
)

Creates a list of EXIF tags by parsing a BLOB of the JPEG-EXIF type.

Parameters
blobthe BLOB to be parsed
sizethe BLOB size (in bytes)
Returns
a list of EXIF tags: or NULL if any error is encountered
See Also
gaiaExifTagsFree
Note
you must explicitly destroy the list when it's any longer used.
GAIAEXIF_DECLARE int gaiaGetExifTagsCount ( gaiaExifTagListPtr  tag_list)

Return the total number of EXIF tags into the list.

Parameters
tag_listpointer to an EXIF tag list.
Returns
the EXIF tag count.
See Also
gaiaGetExifTags, gaiaExifTagsFree
GAIAEXIF_DECLARE int gaiaGetGpsCoords ( const unsigned char *  blob,
int  size,
double *  longitude,
double *  latitude 
)

Return longitude and latitude from an EXIF-GPS tag.

Parameters
blobthe BLOB to be parsed
sizelength of the BLOB (in bytes)
longitudeon success will contain the longitude coordinate
latitudeon success will contain the latitude coordinate
Returns
0 on failure: any other value on success
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaIsExifGpsTag
GAIAEXIF_DECLARE int gaiaGetGpsLatLong ( const unsigned char *  blob,
int  size,
char *  latlong,
int  ll_size 
)

Return a text string representing DMS coordinates from an EXIF-GPS tag.

Parameters
blobthe BLOB to be parsed
sizelength of the BLOB (in bytes)
latlongreceiving buffer: the text string will be copied here.
ll_sizelength of the receiving buffer
Returns
0 on failure: any other value on success
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, gaiaIsExifGpsTag
GAIAEXIF_DECLARE int gaiaGuessBlobType ( const unsigned char *  blob,
int  size 
)

Attempts to guess the actual content-type of some BLOB.

Parameters
blobthe BLOB to be parsed
sizelength of the BLOB (in bytes)
Returns
the BLOB type: one of GAIA_HEX_BLOB, GAIA_GIF_BLOB, GAIA_PNG_BLOB, GAIA_JPEG_BLOB, GAIA_EXIF_BLOB, GAIA_EXIF_GPS_BLOB, GAIA_ZIP_BLOB, GAIA_PDF_BLOB, GAIA_GEOMETRY_BLOB, GAIA_TIFF_BLOB, GAIA_WEBP_BLOB, GAIA_XML_BLOB, GAIA_GPB_BLOB
GAIAEXIF_DECLARE int gaiaIsExifGpsTag ( const gaiaExifTagPtr  tag)

Checks if an EXIF tag actually is an EXIF-GPS tag.

Parameters
tagpointer to an EXIF tag
Returns
0 if false: any other value if true
See Also
gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName