QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ExifUtility Namespace Reference

Functions

ExifData * loadFromBuffer (const QByteArray &buffer)
 
ExifData * createNew ()
 
bool saveToBuffer (ExifData *data, QByteArray &buffer)
 
bool isJpeg (const QByteArray &buffer)
 Check if a buffer is a JPEG image (starts with 0xFF 0xD8)
 
bool isTiff (const QByteArray &buffer)
 
bool hasExifData (const QByteArray &buffer)
 Check if a buffer contains valid JPEG with EXIF data.
 
QString readString (ExifData *data, ExifTag tag, ExifIfd ifd=EXIF_IFD_0)
 Read a string value from an EXIF tag.
 
int readShort (ExifData *data, ExifTag tag, ExifIfd ifd=EXIF_IFD_0)
 Read a short (16-bit) value from an EXIF tag.
 
double readRational (ExifData *data, ExifTag tag, ExifIfd ifd=EXIF_IFD_0)
 Read a rational value from an EXIF tag.
 
ExifEntry * initTag (ExifData *data, ExifIfd ifd, ExifTag tag)
 
ExifEntry * createTag (ExifData *data, ExifIfd ifd, ExifTag tag, ExifFormat format, unsigned long components)
 
double gpsRationalToDecimal (ExifEntry *entry, ExifByteOrder order)
 Convert GPS coordinate from EXIF rational format (deg/min/sec) to decimal degrees.
 
void writeGpsCoordinate (ExifEntry *entry, ExifByteOrder order, double value)
 Write GPS coordinate as EXIF rationals (degrees, minutes, seconds)
 
void writeRational (ExifEntry *entry, ExifByteOrder order, double value, int denominator=100)
 Write a single rational value to an entry.
 
void writeGpsRef (ExifEntry *entry, char value)
 Write an ASCII character to a GPS reference entry (N/S/E/W)
 
void writeGpsAltRef (ExifEntry *entry, unsigned char value)
 Write a byte value to a GPS altitude reference entry (0=above, 1=below sea level)
 
bool writeDateTimeOriginal (ExifData *data, const QDateTime &dateTime)
 

Function Documentation

◆ createNew()

ExifData * ExifUtility::createNew ( )

Create new empty EXIF data structure with standard options set

Returns
ExifData pointer (caller must call exif_data_unref), or nullptr on failure

Definition at line 24 of file ExifUtility.cc.

References createNew().

Referenced by createNew(), and ExifParser::write().

◆ createTag()

ExifEntry * ExifUtility::createTag ( ExifData *  data,
ExifIfd  ifd,
ExifTag  tag,
ExifFormat  format,
unsigned long  components 
)

Create a new entry with custom size for tags that need manual setup Use for GPS tags and other tags that exif_entry_initialize() doesn't handle

Returns
Entry pointer (owned by IFD, do not free), or nullptr on failure

Definition at line 263 of file ExifUtility.cc.

References createTag().

Referenced by createTag(), and ExifParser::write().

◆ gpsRationalToDecimal()

double ExifUtility::gpsRationalToDecimal ( ExifEntry *  entry,
ExifByteOrder  order 
)

Convert GPS coordinate from EXIF rational format (deg/min/sec) to decimal degrees.

Definition at line 308 of file ExifUtility.cc.

References gpsRationalToDecimal().

Referenced by gpsRationalToDecimal().

◆ hasExifData()

bool ExifUtility::hasExifData ( const QByteArray &  buffer)

Check if a buffer contains valid JPEG with EXIF data.

Definition at line 153 of file ExifUtility.cc.

References hasExifData(), isJpeg(), and isTiff().

Referenced by hasExifData().

◆ initTag()

ExifEntry * ExifUtility::initTag ( ExifData *  data,
ExifIfd  ifd,
ExifTag  tag 
)

Get existing entry or create a new one with auto-initialization Use for standard EXIF tags that exif_entry_initialize() can handle

Returns
Entry pointer (owned by IFD, do not free)

Definition at line 234 of file ExifUtility.cc.

References initTag().

Referenced by initTag(), and writeDateTimeOriginal().

◆ isJpeg()

bool ExifUtility::isJpeg ( const QByteArray &  buffer)

Check if a buffer is a JPEG image (starts with 0xFF 0xD8)

Definition at line 128 of file ExifUtility.cc.

References isJpeg().

Referenced by hasExifData(), isJpeg(), and saveToBuffer().

◆ isTiff()

bool ExifUtility::isTiff ( const QByteArray &  buffer)

Check if a buffer is a TIFF-based image (TIFF, DNG, etc.) TIFF files start with "II" (little-endian) or "MM" (big-endian)

Definition at line 135 of file ExifUtility.cc.

References isTiff().

Referenced by hasExifData(), isTiff(), and saveToBuffer().

◆ loadFromBuffer()

ExifData * ExifUtility::loadFromBuffer ( const QByteArray &  buffer)

Load EXIF data from a JPEG buffer

Returns
ExifData pointer (caller must call exif_data_unref), or nullptr on failure

Definition at line 16 of file ExifUtility.cc.

References loadFromBuffer().

Referenced by loadFromBuffer(), ExifParser::readTime(), and ExifParser::write().

◆ readRational()

double ExifUtility::readRational ( ExifData *  data,
ExifTag  tag,
ExifIfd  ifd 
)

Read a rational value from an EXIF tag.

Definition at line 213 of file ExifUtility.cc.

References readRational().

Referenced by readRational().

◆ readShort()

int ExifUtility::readShort ( ExifData *  data,
ExifTag  tag,
ExifIfd  ifd 
)

Read a short (16-bit) value from an EXIF tag.

Definition at line 200 of file ExifUtility.cc.

References readShort().

Referenced by readShort().

◆ readString()

QString ExifUtility::readString ( ExifData *  data,
ExifTag  tag,
ExifIfd  ifd 
)

Read a string value from an EXIF tag.

Definition at line 183 of file ExifUtility.cc.

References readString().

Referenced by readString(), and ExifParser::readTime().

◆ saveToBuffer()

bool ExifUtility::saveToBuffer ( ExifData *  data,
QByteArray &  buffer 
)

Save EXIF data back to a JPEG buffer

Parameters
dataThe EXIF data to save
bufferThe original JPEG buffer (modified in place)
Returns
true if successful
Note
Only JPEG format is supported for writing. TIFF/DNG files return false.

Definition at line 38 of file ExifUtility.cc.

References isJpeg(), isTiff(), and saveToBuffer().

Referenced by saveToBuffer(), and ExifParser::write().

◆ writeDateTimeOriginal()

bool ExifUtility::writeDateTimeOriginal ( ExifData *  data,
const QDateTime &  dateTime 
)

Write a DateTime value to EXIF_TAG_DATE_TIME_ORIGINAL

Parameters
dataThe EXIF data structure
dateTimeThe date/time to write
Returns
true if successful

Definition at line 383 of file ExifUtility.cc.

References initTag(), and writeDateTimeOriginal().

Referenced by writeDateTimeOriginal().

◆ writeGpsAltRef()

void ExifUtility::writeGpsAltRef ( ExifEntry *  entry,
unsigned char  value 
)

Write a byte value to a GPS altitude reference entry (0=above, 1=below sea level)

Definition at line 373 of file ExifUtility.cc.

References writeGpsAltRef().

Referenced by ExifParser::write(), and writeGpsAltRef().

◆ writeGpsCoordinate()

void ExifUtility::writeGpsCoordinate ( ExifEntry *  entry,
ExifByteOrder  order,
double  value 
)

Write GPS coordinate as EXIF rationals (degrees, minutes, seconds)

Definition at line 334 of file ExifUtility.cc.

References writeGpsCoordinate().

Referenced by ExifParser::write(), and writeGpsCoordinate().

◆ writeGpsRef()

void ExifUtility::writeGpsRef ( ExifEntry *  entry,
char  value 
)

Write an ASCII character to a GPS reference entry (N/S/E/W)

Definition at line 366 of file ExifUtility.cc.

References writeGpsRef().

Referenced by ExifParser::write(), and writeGpsRef().

◆ writeRational()

void ExifUtility::writeRational ( ExifEntry *  entry,
ExifByteOrder  order,
double  value,
int  denominator 
)

Write a single rational value to an entry.

Definition at line 355 of file ExifUtility.cc.

References writeRational().

Referenced by ExifParser::write(), and writeRational().