1.3.77
 
Loading...
Searching...
No Matches
exif_writer.cpp File Reference
#include "exif_writer.h"
#include <array>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include "global.h"
#include "pugixml.hpp"

Go to the source code of this file.

Functions

std::vector< unsigned char > helios::detail::buildEXIFAppSegment (const ImageEXIFData &m)
 Build the payload of a JPEG APP1 EXIF segment (excludes the 0xFFE1 marker and 2-byte length, which libjpeg writes).
 
std::vector< unsigned char > helios::detail::buildXMPAppSegment (const ImageEXIFData &m)
 Build the payload of a JPEG APP1 XMP segment (excludes the 0xFFE1 marker and 2-byte length).
 

Detailed Description

Hand-rolled EXIF (TIFF/APP1) and XMP (APP1) segment builders for JPEG embedding.

Copyright (C) 2016-2026 Brian Bailey

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Definition in file exif_writer.cpp.

Function Documentation

◆ buildEXIFAppSegment()

std::vector< unsigned char > helios::detail::buildEXIFAppSegment ( const ImageEXIFData m)

Build the payload of a JPEG APP1 EXIF segment (excludes the 0xFFE1 marker and 2-byte length, which libjpeg writes).

The returned buffer begins with the EXIF identifier "Exif\0\0" followed by a little-endian TIFF header, IFD0, ExifSubIFD, and (when m.gps_valid) GPS IFD. Tags whose corresponding fields in m are unset are omitted.

Parameters
[in]mPopulated metadata struct.
Returns
Byte payload suitable for jpeg_write_marker(&cinfo, JPEG_APP0+1, data, size). Throws via helios_runtime_error if the resulting payload would exceed the JPEG APP1 size limit (65533).

Definition at line 534 of file exif_writer.cpp.

◆ buildXMPAppSegment()

std::vector< unsigned char > helios::detail::buildXMPAppSegment ( const ImageEXIFData m)

Build the payload of a JPEG APP1 XMP segment (excludes the 0xFFE1 marker and 2-byte length).

The returned buffer begins with the XMP namespace identifier "http://ns.adobe.com/xap/1.0/\0" followed by an RDF/XML packet declaring tiff: and Pix4D Camera: namespaces with Yaw / Pitch / Roll values from m.

Parameters
[in]mPopulated metadata struct (must have xmp_valid==true to produce a non-empty payload).
Returns
Byte payload suitable for jpeg_write_marker(&cinfo, JPEG_APP0+1, data, size). Throws via helios_runtime_error if the payload exceeds the JPEG APP1 size limit (65533).

Definition at line 639 of file exif_writer.cpp.

Variable Documentation

◆ count

uint32_t count = 0

Definition at line 76 of file exif_writer.cpp.

◆ external_data

std::vector<unsigned char> external_data

Definition at line 80 of file exif_writer.cpp.

◆ inline_only

bool inline_only = true

Definition at line 81 of file exif_writer.cpp.

◆ inline_value

std::array<unsigned char, 4> inline_value {}

Definition at line 78 of file exif_writer.cpp.

◆ is_pointer_placeholder

bool is_pointer_placeholder = false

Definition at line 85 of file exif_writer.cpp.

◆ pointer_target_index

int pointer_target_index = -1

Definition at line 87 of file exif_writer.cpp.

◆ tag

uint16_t tag = 0

Definition at line 74 of file exif_writer.cpp.

◆ type

uint16_t type = 0

Definition at line 75 of file exif_writer.cpp.