UNPKG

1.71 kBtext/x-cView Raw
1// Copyright 2013 Lovell Fuller and others.
2// SPDX-License-Identifier: Apache-2.0
3
4#ifndef SRC_METADATA_H_
5#define SRC_METADATA_H_
6
7#include <string>
8#include <napi.h>
9
10#include "./common.h"
11
12typedef std::vector<std::pair<std::string, std::string>> MetadataComments;
13
14struct MetadataBaton {
15 // Input
16 sharp::InputDescriptor *input;
17 // Output
18 std::string format;
19 int width;
20 int height;
21 std::string space;
22 int channels;
23 std::string depth;
24 int density;
25 std::string chromaSubsampling;
26 bool isProgressive;
27 int paletteBitDepth;
28 int pages;
29 int pageHeight;
30 int loop;
31 std::vector<int> delay;
32 int pagePrimary;
33 std::string compression;
34 std::string resolutionUnit;
35 std::string formatMagick;
36 std::vector<std::pair<int, int>> levels;
37 int subifds;
38 std::vector<double> background;
39 bool hasProfile;
40 bool hasAlpha;
41 int orientation;
42 char *exif;
43 size_t exifLength;
44 char *icc;
45 size_t iccLength;
46 char *iptc;
47 size_t iptcLength;
48 char *xmp;
49 size_t xmpLength;
50 char *tifftagPhotoshop;
51 size_t tifftagPhotoshopLength;
52 MetadataComments comments;
53 std::string err;
54
55 MetadataBaton():
56 input(nullptr),
57 width(0),
58 height(0),
59 channels(0),
60 density(0),
61 isProgressive(false),
62 paletteBitDepth(0),
63 pages(0),
64 pageHeight(0),
65 loop(-1),
66 pagePrimary(-1),
67 subifds(0),
68 hasProfile(false),
69 hasAlpha(false),
70 orientation(0),
71 exif(nullptr),
72 exifLength(0),
73 icc(nullptr),
74 iccLength(0),
75 iptc(nullptr),
76 iptcLength(0),
77 xmp(nullptr),
78 xmpLength(0),
79 tifftagPhotoshop(nullptr),
80 tifftagPhotoshopLength(0) {}
81};
82
83Napi::Value metadata(const Napi::CallbackInfo& info);
84
85#endif // SRC_METADATA_H_