-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconst.go
173 lines (148 loc) · 4.08 KB
/
const.go
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package tiff
// A tiff image file contains one or more images. The metadata
// of each image is contained in an Image File Directory (IFD),
// which contains entries of 12 bytes each and is described
// on page 14-16 of the specification. An IFD entry consists of
//
// - a tag, which describes the signification of the entry,
// - the data type and length of the entry,
// - the data itself or a pointer to it if it is more than 4 bytes.
//
// The presence of a length means that each IFD is effectively an array.
const (
leHeader = "II\x2A\x00" // Header for little-endian files.
beHeader = "MM\x00\x2A" // Header for big-endian files.
ifdLen = 12 // Length of an IFD entry in bytes.
// TIFF variantes
fTIFF = 0
fDNG = 1
)
// Data types (p. 14-16 of the spec).
const (
dtByte = 1
dtASCII = 2
dtShort = 3
dtLong = 4
dtRational = 5
dtSByte = 6
dtUndefined = 7
dtSShort = 8
dtSLong = 9
dtSRational = 10
dtFloat = 11
dtDouble = 12
)
// The length of one instance of each data type in bytes.
var lengths = [...]uint32{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8}
// Tags (see p. 28-41 of the spec).
const (
tNewSubFileType = 254
tImageWidth = 256
tImageLength = 257
tBitsPerSample = 258
tCompression = 259
tPhotometricInterpretation = 262
tStripOffsets = 273
tSamplesPerPixel = 277
tRowsPerStrip = 278
tStripByteCounts = 279
tTileWidth = 322
tTileLength = 323
tTileOffsets = 324
tTileByteCounts = 325
tXResolution = 282
tYResolution = 283
tPlanarConfiguration = 284
tResolutionUnit = 296
tPredictor = 317
tColorMap = 320
tSubIFDs = 330 // SubIFD trees
tExtraSamples = 338
tSampleFormat = 339
tStonits = 37439
// TIFF/EP
tCFARepeatPatternDim = 33421
tCFAPattern = 33422
// DNG
tDNGVersion = 50706
tDNGBackwardVersion = 50707
tCFAPlaneColor = 50710
tCFALayout = 50711
tLinearizationTable = 50712
tBlackLevel = 50714
tWhiteLevel = 50717
tColorMatrix1 = 50721
tColorMatrix2 = 50722
tCameraCalibration1 = 50723
tCameraCalibration2 = 50724
tReductionMatrix1 = 50725
tReductionMatrix2 = 50726
tAsShotNeutral = 50728
tBaselineExposure = 50730
tCalibrationIlluminant1 = 50778
tCalibrationIlluminant2 = 50779
)
// The Color name of the CFAPatern values.
var cfaColors = []string{"R", "G", "B"}
// Compression types (defined in various places in the spec and supplements).
const (
cNone = 1
cCCITT = 2
cG3 = 3 // Group 3 Fax.
cG4 = 4 // Group 4 Fax.
cLZW = 5
cJPEGOld = 6 // Superseded by cJPEG.
cJPEG = 7
cDeflate = 8 // zlib compression.
cPackBits = 32773
cDeflateOld = 32946 // Superseded by cDeflate.
cSGILogRLE = 34676 // Logluv
cSGILog24Packed = 34677 // Logluv
cLossyJPEG = 34892 // Lossy JPEG is allowed for IFDs that use PhotometricInterpretation = 34892 (LinearRaw) and 8-bit integer data.
)
// Photometric interpretation values (see p. 37 of the spec).
const (
pWhiteIsZero = 0
pBlackIsZero = 1
pRGB = 2
pPaletted = 3
pTransMask = 4 // transparency mask
pCMYK = 5
pYCbCr = 6
pCIELab = 8
pColorFilterArray = 32803
pLogL = 32844 // GrayScale - CIE Log2(L)
pLogLuv = 32845 // Color - CIE Log2(L) (u',v')
)
// Values for the tPredictor tag (page 64-65 of the spec).
const (
prNone = 1
prHorizontal = 2
prFloatingPoint = 3 // Floating point horizontal differencing, a third specification supplement from Adobe
)
// Value for the tNewSubFileType tag (cf. SubIFDs Trees)
const (
sftPrimaryImage = 0
sftThumbnail = 1
)
// Values for the tResolutionUnit tag (page 18).
const (
resNone = 1
resPerInch = 2 // Dots per inch.
resPerCM = 3 // Dots per centimeter.
)
// imageMode represents the mode of the image.
type imageMode int
const (
mBilevel imageMode = iota
mPaletted
mGray
mGrayInvert
mRGB
mRGBA
mNRGBA
mNYCbCrA
mLogL
mLogLuv
mColorFilterArray
)