about summary refs log tree commit diff
path: root/converter/other/exif.h
blob: 18c59f084135c49acf947a307fe27a55d82da6ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef EXIF_H_INCLUDED
#define EXIF_H_INCLUDED

#include <stdio.h>
#include "netpbm/pm_c_util.h"

#define MAX_COMMENT 2000

#if MSVCRT
    #define PATH_MAX _MAX_PATH
#endif

typedef struct {
/*--------------------------------------------------------------------------
  A structure of this type contains the information from an EXIF header
  Image File Directory (IFD).

  It appears that some of these members are possible only for certain kinds of
  IFD (e.g. ThumbnailSize does not appear in a legal IFD for a main image),
  but we recognize all tags in all IFDs all the same.
--------------------------------------------------------------------------*/
    char  cameraMake   [32];
    char  cameraModel  [40];
    char  dateTime     [20];
    float xResolution;
    float yResolution;
    int   orientation;
    int   isColor;
    int   flashUsed;
    float focalLength;
    float exposureTime;
    float apertureFNumber;
    float distance;
    float exposureBias;
    int   whiteBalance;
    int   meteringMode;
    int   exposureProgram;
    int   isoEquivalent;
    int   compressionLevel;
    char  comments[MAX_COMMENT];
    unsigned int thumbnailOffset;
    unsigned int thumbnailLength;
    unsigned int imageLength;
    unsigned int imageWidth;
    double       focalPlaneXRes;
    double       focalPlaneUnits;

    const unsigned char * thumbnail;  /* Pointer at the thumbnail */
    unsigned thumbnailSize;     /* Size of thumbnail. */
} exif_ifd;


typedef struct {
/*--------------------------------------------------------------------------
  A structure of this type contains the information from an EXIF header.
--------------------------------------------------------------------------*/
    exif_ifd mainImage;       /* aka IFD0 */
    exif_ifd thumbnailImage;  /* aka IFD1 */
    bool     haveCCDWidth;
    float    ccdWidth;
} exif_ImageInfo;


/* Prototypes for exif.c functions. */

void
exif_parse(const unsigned char * const exifSection,
           unsigned int          const length,
           exif_ImageInfo *      const imageInfoP,
           bool                  const wantTagTrace,
           const char **         const errorP);

void
exif_showImageInfo(const exif_ImageInfo * const imageInfoP);

#endif