author | Claus Gittinger <cg@exept.de> |
Tue, 29 Aug 2017 02:19:30 +0200 | |
changeset 3994 | 8ab8729d5dec |
parent 3989 | a1fa18648a9c |
child 4000 | d39d58494281 |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
28 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1571 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
3552 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
0 | 16 |
ImageReader subclass:#TIFFReader |
192 | 17 |
instanceVariableNames:'planarConfiguration subFileType stripOffsets rowsPerStrip |
159
327da5085900
fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
18 |
fillOrder compression group3options predictor stripByteCounts |
3984 | 19 |
currentOffset stripOffsetsPos stripByteCountsPos stripRowCounts |
20 |
bitsPerSamplePos colorMapPos orientation isBigTiff tileOffsets |
|
21 |
tileByteCounts tileWidth tileLength sampleFormat minSampleValue |
|
22 |
maxSampleValue subIfds decodeMetaTags loadFullResolutionImage |
|
23 |
isDNGImage' |
|
24 |
classVariableNames:'Verbose COMPRESSION_NONE COMPRESSION_CCITTRLE |
|
25 |
COMPRESSION_CCITTFAX3 COMPRESSION_CCITTFAX4 COMPRESSION_LZW |
|
26 |
COMPRESSION_OJPEG COMPRESSION_JPEG COMPRESSION_ADOBE_DEFLATE |
|
27 |
COMPRESSION_JBIG_T85 COMPRESSION_JBIG_T43 COMPRESSION_NEXT |
|
28 |
COMPRESSION_CCITTRLEW COMPRESSION_PACKBITS |
|
29 |
COMPRESSION_THUNDERSCAN COMPRESSION_IT8CTPAD COMPRESSION_IT8LW |
|
30 |
COMPRESSION_IT8MP COMPRESSION_IT8BL COMPRESSION_PIXARFILM |
|
31 |
COMPRESSION_PIXARLOG COMPRESSION_DEFLATE COMPRESSION_DCS |
|
32 |
COMPRESSION_JBIG COMPRESSION_JPEG2000 COMPRESSION_NIKON_NEF |
|
33 |
COMPRESSION_JBIG2 COMPRESSION_NEXT_JPEG SAMPLEFORMAT_UINT |
|
34 |
SAMPLEFORMAT_INT SAMPLEFORMAT_IEEEFP SAMPLEFORMAT_VOID |
|
35 |
SAMPLEFORMAT_COMPLEXINT SAMPLEFORMAT_COMPLEXIEEEFP |
|
36 |
COMPRESSION_SGILOG COMPRESSION_SGILOG24 PLANARCONFIG_CONTIG |
|
37 |
PLANARCONFIG_SEPARATE FILETYPE_MASK_REDUCEDIMAGE |
|
3986 | 38 |
FILETYPE_MASK_PAGE FILETYPE_MASK_MASK FILLORDER_MSB2LSB |
39 |
FILLORDER_LSB2MSB' |
|
192 | 40 |
poolDictionaries:'' |
1745
4fa0fad2a463
code cleanup (colorMap handling)
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
41 |
category:'Graphics-Images-Readers' |
0 | 42 |
! |
43 |
||
3693 | 44 |
Dictionary subclass:#TIFFMetaData |
45 |
instanceVariableNames:'' |
|
46 |
classVariableNames:'' |
|
47 |
poolDictionaries:'' |
|
48 |
privateIn:TIFFReader |
|
49 |
! |
|
50 |
||
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
51 |
!TIFFReader class methodsFor:'documentation'! |
0 | 52 |
|
21 | 53 |
copyright |
54 |
" |
|
55 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
28 | 56 |
All Rights Reserved |
21 | 57 |
|
58 |
This software is furnished under a license and may be used |
|
59 |
only in accordance with the terms of that license and with the |
|
60 |
inclusion of the above copyright notice. This software may not |
|
61 |
be provided or otherwise made available to, or used by, any |
|
62 |
other person. No title to or ownership of the software is |
|
63 |
hereby transferred. |
|
64 |
" |
|
65 |
! |
|
66 |
||
0 | 67 |
documentation |
68 |
" |
|
3977 | 69 |
This class knows how to read TIFF files and how to write uncompressed TIFF files. |
14 | 70 |
|
1826 | 71 |
Implemented & Missing Features: |
14 | 72 |
|
1826 | 73 |
- Only single image files are supported. |
3977 | 74 |
|
1826 | 75 |
- Not all formats are implemented, and of those that are, not all are tested. |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
76 |
It should read with most rgb, palette, mono and greyscale images, |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
77 |
although the alpha channel is currently not supported and ignored. |
1826 | 78 |
It supports reading of uncompressed, LZW, packbits and CCITT-G3 compressed images |
79 |
JPEG and many other formats are currently not implemented. |
|
30 | 80 |
|
1826 | 81 |
- Only writing of uncompressed images is currently implemented. |
82 |
It should write (at least) mono, 8-bit palette and 24 bit rgb formats. |
|
83 |
||
3977 | 84 |
- bigTiff is supported |
3984 | 85 |
|
3979 | 86 |
- some dng tags are supported |
3977 | 87 |
|
88 |
More formats will come... (will they ever be needed?) |
|
1826 | 89 |
|
3977 | 90 |
TODO (?): |
91 |
since I don't want to spend all of my life adding more formats here and |
|
92 |
reinventing the wheel, this code should be changed to use the tiff library. |
|
93 |
That would give us most formats and also writing capabilities for free. |
|
94 |
||
95 |
Late note: |
|
96 |
I hate C and interfacing to C libraries: it almost always leads to trouble |
|
97 |
w.r.t. memory leaks, non-reentrancy, non-interruptability etc. |
|
98 |
(we recently fixed a malloc-non-reentrant bug for some architecture...) |
|
99 |
So its probably better to do it all in a real programming language ;-) |
|
195 | 100 |
|
220 | 101 |
[author:] |
102 |
Claus Gittinger |
|
103 |
||
195 | 104 |
[See also:] |
234 | 105 |
Image Form Icon |
197 | 106 |
BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader |
210 | 107 |
ST80FormReader SunRasterReader TargaReader WindowsIconReader |
209 | 108 |
XBMReader XPMReader XWDReader |
0 | 109 |
" |
110 |
! ! |
|
111 |
||
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
112 |
!TIFFReader class methodsFor:'initialization'! |
28 | 113 |
|
114 |
initialize |
|
198 | 115 |
"install myself in the Image classes fileFormat table |
398 | 116 |
for the `.tiff' and `.tif' extensions." |
198 | 117 |
|
3984 | 118 |
MIMETypes defineImageType:'image/tiff' suffix:'tif' reader:self info:'tiff image'. |
647 | 119 |
MIMETypes defineImageType:nil suffix:'tiff' reader:self. |
198 | 120 |
|
3984 | 121 |
MIMETypes defineImageType:'image/x-adobe-dng' suffix:'dng' reader:self info:'digital negative image'. |
122 |
||
123 |
COMPRESSION_NONE := 1. |
|
124 |
COMPRESSION_CCITTRLE := 2. |
|
125 |
COMPRESSION_CCITTFAX3 := 3. |
|
126 |
COMPRESSION_CCITTFAX4 := 4. |
|
127 |
COMPRESSION_LZW := 5. |
|
128 |
COMPRESSION_OJPEG := 6. "/ (old style jpeg) |
|
129 |
COMPRESSION_JPEG := 7. "/ (new style jpeg) |
|
130 |
COMPRESSION_ADOBE_DEFLATE := 8. |
|
131 |
COMPRESSION_JBIG_T85 := 9. "/ (ITU-T T85) |
|
132 |
COMPRESSION_JBIG_T43 := 10. "/ (ITU-T T43) |
|
133 |
||
134 |
COMPRESSION_NEXT := 32766. "/ (NeXT 2-bit encoding) |
|
135 |
COMPRESSION_CCITTRLEW := 32771. |
|
136 |
COMPRESSION_PACKBITS := 32773. |
|
137 |
COMPRESSION_THUNDERSCAN := 32809. "/ (ThunderScan 4-bit encoding) |
|
138 |
COMPRESSION_NEXT_JPEG := 32865. "/ (NeXT jpeg encoding) |
|
139 |
COMPRESSION_IT8CTPAD := 32895. |
|
140 |
COMPRESSION_IT8LW := 32896. |
|
141 |
COMPRESSION_IT8MP := 32897. |
|
142 |
COMPRESSION_IT8BL := 32898. |
|
143 |
COMPRESSION_PIXARFILM := 32908. |
|
144 |
COMPRESSION_PIXARLOG := 32909. "/ (Pixar companded 11-bit ZIP encoding) |
|
145 |
COMPRESSION_DEFLATE := 32946. "/ (PKZIP-style Deflate encoding) |
|
146 |
COMPRESSION_DCS := 32947. "/ (kodac) |
|
147 |
COMPRESSION_JBIG := 34661. |
|
148 |
COMPRESSION_SGILOG := 34676. "/ (SGI 32-bit Log Luminance encoding) |
|
149 |
COMPRESSION_SGILOG24 := 34677. "/ (SGI 24-bit Log Luminance encoding) |
|
150 |
COMPRESSION_JPEG2000 := 34712. "/ JPEG2000 |
|
151 |
COMPRESSION_NIKON_NEF := 34713. |
|
152 |
COMPRESSION_JBIG2 := 34715. |
|
153 |
||
154 |
SAMPLEFORMAT_UINT := 1. "/ !!unsigned integer data |
|
155 |
SAMPLEFORMAT_INT := 2. "/ !!signed integer data |
|
156 |
SAMPLEFORMAT_IEEEFP := 3. "/ !!IEEE floating point data |
|
157 |
SAMPLEFORMAT_VOID := 4. "/ !!untyped data |
|
158 |
SAMPLEFORMAT_COMPLEXINT := 5. "/ !!complex signed int |
|
159 |
SAMPLEFORMAT_COMPLEXIEEEFP := 6. "/ !!complex ieee floating |
|
160 |
||
161 |
PLANARCONFIG_CONTIG := 1. |
|
162 |
PLANARCONFIG_SEPARATE := 2. |
|
163 |
||
164 |
FILETYPE_MASK_REDUCEDIMAGE := 1. |
|
165 |
FILETYPE_MASK_PAGE := 2. |
|
166 |
FILETYPE_MASK_MASK := 4. |
|
167 |
||
3986 | 168 |
FILLORDER_MSB2LSB := 1. |
169 |
FILLORDER_LSB2MSB := 2. |
|
170 |
||
3984 | 171 |
"/ TYPE_NOTYPE := 0. "/ placeholder |
172 |
"/ TYPE_BYTE := 1. "/ 8-bit unsigned integer |
|
173 |
"/ TYPE_ASCII := 2. "/ 8-bit bytes w/ last byte null |
|
174 |
"/ TYPE_SHORT := 3. "/ 16-bit unsigned integer |
|
175 |
"/ TYPE_LONG := 4. "/ 32-bit unsigned integer |
|
176 |
"/ TYPE_RATIONAL := 5. "/ 64-bit unsigned fraction |
|
177 |
"/ TYPE_SBYTE := 6. "/ !!8-bit signed integer |
|
178 |
"/ TYPE_UNDEFINED := 7. "/ !!8-bit untyped data |
|
179 |
"/ TYPE_SSHORT := 8. "/ !!16-bit signed integer |
|
180 |
"/ TYPE_SLONG := 9. "/ !!32-bit signed integer |
|
181 |
"/ TYPE_SRATIONAL := 10. "/ !!64-bit signed fraction |
|
182 |
"/ TYPE_FLOAT := 11. "/ !!32-bit IEEE floating point |
|
183 |
"/ TYPE_DOUBLE := 12. "/ !!64-bit IEEE floating point |
|
184 |
"/ TYPE_IFD := 13. "/ %32-bit unsigned integer (offset) |
|
185 |
"/ TYPE_LONG8 := 16. "/ BigTIFF 64-bit unsigned integer |
|
186 |
"/ TYPE_SLONG8 := 17. "/ BigTIFF 64-bit signed integer |
|
187 |
"/ TYPE_IFD8 := 18. "/ BigTIFF 64-bit unsigned integer (offset) |
|
188 |
||
189 |
"/ |
|
190 |
"/ TIFF tags |
|
191 |
"/ |
|
192 |
||
193 |
"/ #define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ |
|
194 |
"/ #define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ |
|
195 |
"/ #define FILETYPE_PAGE 0x2 /* one page of many */ |
|
196 |
"/ #define FILETYPE_MASK 0x4 /* transparency mask */ |
|
197 |
"/ #define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ |
|
198 |
"/ #define OFILETYPE_IMAGE 1 /* full resolution image data */ |
|
199 |
"/ #define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ |
|
200 |
"/ #define OFILETYPE_PAGE 3 /* one page of many */ |
|
201 |
"/ #define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ |
|
202 |
"/ #define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ |
|
203 |
"/ #define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ |
|
204 |
"/ #define TIFFTAG_COMPRESSION 259 /* data compression technique */ |
|
205 |
"/ #define COMPRESSION_NONE 1 /* dump mode */ |
|
206 |
"/ #define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ |
|
207 |
"/ #define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ |
|
208 |
"/ #define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */ |
|
209 |
"/ #define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ |
|
210 |
"/ #define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */ |
|
211 |
"/ #define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ |
|
212 |
"/ #define COMPRESSION_OJPEG 6 /* !!6.0 JPEG */ |
|
213 |
"/ #define COMPRESSION_JPEG 7 /* %JPEG DCT compression */ |
|
214 |
"/ #define COMPRESSION_T85 9 /* !!TIFF/FX T.85 JBIG compression */ |
|
215 |
"/ #define COMPRESSION_T43 10 /* !!TIFF/FX T.43 colour by layered JBIG compression */ |
|
216 |
"/ #define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ |
|
217 |
"/ #define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ |
|
218 |
"/ #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ |
|
219 |
"/ #define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ |
|
220 |
"/ /* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */ |
|
221 |
"/ #define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */ |
|
222 |
"/ #define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */ |
|
223 |
"/ #define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */ |
|
224 |
"/ #define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */ |
|
225 |
"/ /* compression codes 32908-32911 are reserved for Pixar */ |
|
226 |
"/ #define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */ |
|
227 |
"/ #define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */ |
|
228 |
"/ #define COMPRESSION_DEFLATE 32946 /* Deflate compression */ |
|
229 |
"/ #define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, |
|
230 |
"/ as recognized by Adobe */ |
|
231 |
"/ /* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */ |
|
232 |
"/ #define COMPRESSION_DCS 32947 /* Kodak DCS encoding */ |
|
233 |
"/ #define COMPRESSION_JBIG 34661 /* ISO JBIG */ |
|
234 |
"/ #define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */ |
|
235 |
"/ #define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */ |
|
236 |
"/ #define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */ |
|
237 |
"/ #define COMPRESSION_LZMA 34925 /* LZMA2 */ |
|
238 |
"/ #define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ |
|
239 |
"/ #define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ |
|
240 |
"/ #define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ |
|
241 |
"/ #define PHOTOMETRIC_RGB 2 /* RGB color model */ |
|
242 |
"/ #define PHOTOMETRIC_PALETTE 3 /* color map indexed */ |
|
243 |
"/ #define PHOTOMETRIC_MASK 4 /* $holdout mask */ |
|
244 |
"/ #define PHOTOMETRIC_SEPARATED 5 /* !!color separations */ |
|
245 |
"/ #define PHOTOMETRIC_YCBCR 6 /* !!CCIR 601 */ |
|
246 |
"/ #define PHOTOMETRIC_CIELAB 8 /* !!1976 CIE L*a*b* */ |
|
247 |
"/ #define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */ |
|
248 |
"/ #define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */ |
|
249 |
"/ #define PHOTOMETRIC_CFA 32803 /* color filter array */ |
|
250 |
"/ #define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */ |
|
251 |
"/ #define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */ |
|
252 |
"/ #define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ |
|
253 |
"/ #define THRESHHOLD_BILEVEL 1 /* b&w art scan */ |
|
254 |
"/ #define THRESHHOLD_HALFTONE 2 /* or dithered scan */ |
|
255 |
"/ #define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ |
|
256 |
"/ #define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ |
|
257 |
"/ #define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ |
|
258 |
"/ #define TIFFTAG_FILLORDER 266 /* data order within a byte */ |
|
259 |
"/ #define FILLORDER_MSB2LSB 1 /* most significant -> least */ |
|
260 |
"/ #define FILLORDER_LSB2MSB 2 /* least significant -> most */ |
|
261 |
"/ #define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ |
|
262 |
"/ #define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ |
|
263 |
"/ #define TIFFTAG_MAKE 271 /* scanner manufacturer name */ |
|
264 |
"/ #define TIFFTAG_MODEL 272 /* scanner model name/number */ |
|
265 |
"/ #define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ |
|
266 |
"/ #define TIFFTAG_ORIENTATION 274 /* +image orientation */ |
|
267 |
"/ #define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ |
|
268 |
"/ #define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ |
|
269 |
"/ #define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ |
|
270 |
"/ #define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ |
|
271 |
"/ #define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ |
|
272 |
"/ #define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ |
|
273 |
"/ #define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ |
|
274 |
"/ #define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ |
|
275 |
"/ #define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ |
|
276 |
"/ #define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ |
|
277 |
"/ #define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ |
|
278 |
"/ #define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ |
|
279 |
"/ #define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ |
|
280 |
"/ #define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ |
|
281 |
"/ #define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ |
|
282 |
"/ #define TIFFTAG_PLANARCONFIG 284 /* storage organization */ |
|
283 |
"/ #define PLANARCONFIG_CONTIG 1 /* single image plane */ |
|
284 |
"/ #define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ |
|
285 |
"/ #define TIFFTAG_PAGENAME 285 /* page name image is from */ |
|
286 |
"/ #define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ |
|
287 |
"/ #define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ |
|
288 |
"/ #define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ |
|
289 |
"/ #define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ |
|
290 |
"/ #define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ |
|
291 |
"/ #define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ |
|
292 |
"/ #define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ |
|
293 |
"/ #define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ |
|
294 |
"/ #define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ |
|
295 |
"/ #define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ |
|
296 |
"/ #define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ |
|
297 |
"/ #define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ |
|
298 |
"/ #define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */ |
|
299 |
"/ #define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ |
|
300 |
"/ #define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ |
|
301 |
"/ #define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ |
|
302 |
"/ #define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ |
|
303 |
"/ #define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */ |
|
304 |
"/ #define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ |
|
305 |
"/ #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ |
|
306 |
"/ #define RESUNIT_NONE 1 /* no meaningful units */ |
|
307 |
"/ #define RESUNIT_INCH 2 /* english */ |
|
308 |
"/ #define RESUNIT_CENTIMETER 3 /* metric */ |
|
309 |
"/ #define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ |
|
310 |
"/ #define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ |
|
311 |
"/ #define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ |
|
312 |
"/ #define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ |
|
313 |
"/ #define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ |
|
314 |
"/ #define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ |
|
315 |
"/ #define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ |
|
316 |
"/ #define TIFFTAG_TRANSFERFUNCTION 301 /* !!colorimetry info */ |
|
317 |
"/ #define TIFFTAG_SOFTWARE 305 /* name & release */ |
|
318 |
"/ #define TIFFTAG_DATETIME 306 /* creation date and time */ |
|
319 |
"/ #define TIFFTAG_ARTIST 315 /* creator of image */ |
|
320 |
"/ #define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ |
|
321 |
"/ #define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ |
|
322 |
"/ #define PREDICTOR_NONE 1 /* no prediction scheme used */ |
|
323 |
"/ #define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */ |
|
324 |
"/ #define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */ |
|
325 |
"/ #define TIFFTAG_WHITEPOINT 318 /* image white point */ |
|
326 |
"/ #define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !!primary chromaticities */ |
|
327 |
"/ #define TIFFTAG_COLORMAP 320 /* RGB map for palette image */ |
|
328 |
"/ #define TIFFTAG_HALFTONEHINTS 321 /* !!highlight+shadow info */ |
|
329 |
"/ #define TIFFTAG_TILEWIDTH 322 /* !!tile width in pixels */ |
|
330 |
"/ #define TIFFTAG_TILELENGTH 323 /* !!tile height in pixels */ |
|
331 |
"/ #define TIFFTAG_TILEOFFSETS 324 /* !!offsets to data tiles */ |
|
332 |
"/ #define TIFFTAG_TILEBYTECOUNTS 325 /* !!byte counts for tiles */ |
|
333 |
"/ #define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ |
|
334 |
"/ #define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ |
|
335 |
"/ #define CLEANFAXDATA_CLEAN 0 /* no errors detected */ |
|
336 |
"/ #define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ |
|
337 |
"/ #define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ |
|
338 |
"/ #define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ |
|
339 |
"/ #define TIFFTAG_SUBIFD 330 /* subimage descriptors */ |
|
340 |
"/ #define TIFFTAG_INKSET 332 /* !!inks in separated image */ |
|
341 |
"/ #define INKSET_CMYK 1 /* !!cyan-magenta-yellow-black color */ |
|
342 |
"/ #define INKSET_MULTIINK 2 /* !!multi-ink or hi-fi color */ |
|
343 |
"/ #define TIFFTAG_INKNAMES 333 /* !!ascii names of inks */ |
|
344 |
"/ #define TIFFTAG_NUMBEROFINKS 334 /* !!number of inks */ |
|
345 |
"/ #define TIFFTAG_DOTRANGE 336 /* !!0% and 100% dot codes */ |
|
346 |
"/ #define TIFFTAG_TARGETPRINTER 337 /* !!separation target */ |
|
347 |
"/ #define TIFFTAG_EXTRASAMPLES 338 /* !!info about extra samples */ |
|
348 |
"/ #define EXTRASAMPLE_UNSPECIFIED 0 /* !!unspecified data */ |
|
349 |
"/ #define EXTRASAMPLE_ASSOCALPHA 1 /* !!associated alpha data */ |
|
350 |
"/ #define EXTRASAMPLE_UNASSALPHA 2 /* !!unassociated alpha data */ |
|
351 |
"/ #define TIFFTAG_SAMPLEFORMAT 339 /* !!data sample format */ |
|
352 |
"/ #define SAMPLEFORMAT_UINT 1 /* !!unsigned integer data */ |
|
353 |
"/ #define SAMPLEFORMAT_INT 2 /* !!signed integer data */ |
|
354 |
"/ #define SAMPLEFORMAT_IEEEFP 3 /* !!IEEE floating point data */ |
|
355 |
"/ #define SAMPLEFORMAT_VOID 4 /* !!untyped data */ |
|
356 |
"/ #define SAMPLEFORMAT_COMPLEXINT 5 /* !!complex signed int */ |
|
357 |
"/ #define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !!complex ieee floating */ |
|
358 |
"/ #define TIFFTAG_SMINSAMPLEVALUE 340 /* !!variable MinSampleValue */ |
|
359 |
"/ #define TIFFTAG_SMAXSAMPLEVALUE 341 /* !!variable MaxSampleValue */ |
|
360 |
"/ #define TIFFTAG_CLIPPATH 343 /* %ClipPath |
|
361 |
"/ [Adobe TIFF technote 2] */ |
|
362 |
"/ #define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits |
|
363 |
"/ [Adobe TIFF technote 2] */ |
|
364 |
"/ #define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits |
|
365 |
"/ [Adobe TIFF technote 2] */ |
|
366 |
"/ #define TIFFTAG_INDEXED 346 /* %Indexed |
|
367 |
"/ [Adobe TIFF Technote 3] */ |
|
368 |
"/ #define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */ |
|
369 |
"/ #define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */ |
|
370 |
"/ /* Tags 400-435 are from the TIFF/FX spec */ |
|
371 |
"/ #define TIFFTAG_GLOBALPARAMETERSIFD 400 /* !! */ |
|
372 |
"/ #define TIFFTAG_PROFILETYPE 401 /* !! */ |
|
373 |
"/ #define PROFILETYPE_UNSPECIFIED 0 /* !! */ |
|
374 |
"/ #define PROFILETYPE_G3_FAX 1 /* !! */ |
|
375 |
"/ #define TIFFTAG_FAXPROFILE 402 /* !! */ |
|
376 |
"/ #define FAXPROFILE_S 1 /* !!TIFF/FX FAX profile S */ |
|
377 |
"/ #define FAXPROFILE_F 2 /* !!TIFF/FX FAX profile F */ |
|
378 |
"/ #define FAXPROFILE_J 3 /* !!TIFF/FX FAX profile J */ |
|
379 |
"/ #define FAXPROFILE_C 4 /* !!TIFF/FX FAX profile C */ |
|
380 |
"/ #define FAXPROFILE_L 5 /* !!TIFF/FX FAX profile L */ |
|
381 |
"/ #define FAXPROFILE_M 6 /* !!TIFF/FX FAX profile LM */ |
|
382 |
"/ #define TIFFTAG_CODINGMETHODS 403 /* !!TIFF/FX coding methods */ |
|
383 |
"/ #define CODINGMETHODS_T4_1D (1 << 1) /* !!T.4 1D */ |
|
384 |
"/ #define CODINGMETHODS_T4_2D (1 << 2) /* !!T.4 2D */ |
|
385 |
"/ #define CODINGMETHODS_T6 (1 << 3) /* !!T.6 */ |
|
386 |
"/ #define CODINGMETHODS_T85 (1 << 4) /* !!T.85 JBIG */ |
|
387 |
"/ #define CODINGMETHODS_T42 (1 << 5) /* !!T.42 JPEG */ |
|
388 |
"/ #define CODINGMETHODS_T43 (1 << 6) /* !!T.43 colour by layered JBIG */ |
|
389 |
"/ #define TIFFTAG_VERSIONYEAR 404 /* !!TIFF/FX version year */ |
|
390 |
"/ #define TIFFTAG_MODENUMBER 405 /* !!TIFF/FX mode number */ |
|
391 |
"/ #define TIFFTAG_DECODE 433 /* !!TIFF/FX decode */ |
|
392 |
"/ #define TIFFTAG_IMAGEBASECOLOR 434 /* !!TIFF/FX image base colour */ |
|
393 |
"/ #define TIFFTAG_T82OPTIONS 435 /* !!TIFF/FX T.82 options */ |
|
394 |
"/ /* |
|
395 |
"/ * Tags 512-521 are obsoleted by Technical Note #2 which specifies a |
|
396 |
"/ * revised JPEG-in-TIFF scheme. |
|
397 |
"/ */ |
|
398 |
"/ #define TIFFTAG_JPEGPROC 512 /* !!JPEG processing algorithm */ |
|
399 |
"/ #define JPEGPROC_BASELINE 1 /* !!baseline sequential */ |
|
400 |
"/ #define JPEGPROC_LOSSLESS 14 /* !!Huffman coded lossless */ |
|
401 |
"/ #define TIFFTAG_JPEGIFOFFSET 513 /* !!pointer to SOI marker */ |
|
402 |
"/ #define TIFFTAG_JPEGIFBYTECOUNT 514 /* !!JFIF stream length */ |
|
403 |
"/ #define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !!restart interval length */ |
|
404 |
"/ #define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !!lossless proc predictor */ |
|
405 |
"/ #define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !!lossless point transform */ |
|
406 |
"/ #define TIFFTAG_JPEGQTABLES 519 /* !!Q matrix offsets */ |
|
407 |
"/ #define TIFFTAG_JPEGDCTABLES 520 /* !!DCT table offsets */ |
|
408 |
"/ #define TIFFTAG_JPEGACTABLES 521 /* !!AC coefficient offsets */ |
|
409 |
"/ #define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !!RGB -> YCbCr transform */ |
|
410 |
"/ #define TIFFTAG_YCBCRSUBSAMPLING 530 /* !!YCbCr subsampling factors */ |
|
411 |
"/ #define TIFFTAG_YCBCRPOSITIONING 531 /* !!subsample positioning */ |
|
412 |
"/ #define YCBCRPOSITION_CENTERED 1 /* !!as in PostScript Level 2 */ |
|
413 |
"/ #define YCBCRPOSITION_COSITED 2 /* !!as in CCIR 601-1 */ |
|
414 |
"/ #define TIFFTAG_REFERENCEBLACKWHITE 532 /* !!colorimetry info */ |
|
415 |
"/ #define TIFFTAG_STRIPROWCOUNTS 559 /* !!TIFF/FX strip row counts */ |
|
416 |
"/ #define TIFFTAG_XMLPACKET 700 /* %XML packet |
|
417 |
"/ [Adobe XMP Specification, |
|
418 |
"/ January 2004 */ |
|
419 |
"/ #define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID |
|
420 |
"/ [Adobe TIFF technote] */ |
|
421 |
||
422 |
"/ /* tags 32952-32956 are private tags registered to Island Graphics */ |
|
423 |
"/ #define TIFFTAG_REFPTS 32953 /* image reference points */ |
|
424 |
"/ #define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */ |
|
425 |
"/ #define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */ |
|
426 |
"/ #define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */ |
|
427 |
||
428 |
"/ /* tags 32995-32999 are private tags registered to SGI */ |
|
429 |
"/ #define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ |
|
430 |
"/ #define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ |
|
431 |
"/ #define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ |
|
432 |
"/ #define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ |
|
433 |
||
434 |
"/ /* tags 33300-33309 are private tags registered to Pixar */ |
|
435 |
"/ /* |
|
436 |
"/ * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH |
|
437 |
"/ * are set when an image has been cropped out of a larger image. |
|
438 |
"/ * They reflect the size of the original uncropped image. |
|
439 |
"/ * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used |
|
440 |
"/ * to determine the position of the smaller image in the larger one. |
|
441 |
"/ */ |
|
442 |
"/ #define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */ |
|
443 |
"/ #define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */ |
|
444 |
"/ /* Tags 33302-33306 are used to identify special image modes and data |
|
445 |
"/ * used by Pixar's texture formats. |
|
446 |
"/ */ |
|
447 |
"/ #define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */ |
|
448 |
"/ #define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */ |
|
449 |
"/ #define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */ |
|
450 |
"/ #define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305 |
|
451 |
"/ #define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306 |
|
452 |
||
453 |
"/ /* tag 33405 is a private tag registered to Eastman Kodak */ |
|
454 |
"/ #define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */ |
|
455 |
||
456 |
"/ #define TIFFTAG_CFAREPEATPATTERNDIM 33421 /* dimensions of CFA pattern */ |
|
457 |
"/ #define TIFFTAG_CFAPATTERN 33422 /* color filter array pattern */ |
|
458 |
"/ /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */ |
|
459 |
"/ #define TIFFTAG_COPYRIGHT 33432 /* copyright string */ |
|
460 |
"/ /* IPTC TAG from RichTIFF specifications */ |
|
461 |
"/ #define TIFFTAG_RICHTIFFIPTC 33723 |
|
462 |
"/ /* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */ |
|
463 |
"/ #define TIFFTAG_IT8SITE 34016 /* site name */ |
|
464 |
"/ #define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */ |
|
465 |
"/ #define TIFFTAG_IT8HEADER 34018 /* DDES Header */ |
|
466 |
"/ #define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */ |
|
467 |
"/ #define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */ |
|
468 |
"/ #define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */ |
|
469 |
"/ #define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */ |
|
470 |
"/ #define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */ |
|
471 |
"/ #define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */ |
|
472 |
"/ #define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */ |
|
473 |
"/ #define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */ |
|
474 |
"/ #define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */ |
|
475 |
"/ #define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */ |
|
476 |
"/ #define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */ |
|
477 |
"/ #define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */ |
|
478 |
"/ #define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator |
|
479 |
"/ (untrapped=0, trapped=1) */ |
|
480 |
"/ #define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */ |
|
481 |
||
482 |
"/ /* tags 34232-34236 are private tags registered to Texas Instruments */ |
|
483 |
"/ #define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */ |
|
484 |
||
485 |
"/ /* tag 34377 is private tag registered to Adobe for PhotoShop */ |
|
486 |
"/ #define TIFFTAG_PHOTOSHOP 34377 |
|
487 |
||
488 |
"/ /* tags 34665, 34853 and 40965 are documented in EXIF specification */ |
|
489 |
"/ #define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */ |
|
490 |
||
491 |
"/ /* tag 34750 is a private tag registered to Adobe? */ |
|
492 |
"/ #define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */ |
|
493 |
"/ #define TIFFTAG_IMAGELAYER 34732 /* !!TIFF/FX image layer information */ |
|
494 |
||
495 |
"/ /* tag 34750 is a private tag registered to Pixel Magic */ |
|
496 |
"/ #define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */ |
|
497 |
"/ #define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */ |
|
498 |
||
499 |
"/ /* tags 34908-34914 are private tags registered to SGI */ |
|
500 |
"/ #define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */ |
|
501 |
"/ #define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */ |
|
502 |
"/ #define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */ |
|
503 |
"/ #define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */ |
|
504 |
||
505 |
"/ /* tags 37439-37443 are registered to SGI <gregl@sgi.com> */ |
|
506 |
"/ #define TIFFTAG_STONITS 37439 /* Sample value to Nits */ |
|
507 |
||
508 |
"/ /* tag 34929 is a private tag registered to FedEx */ |
|
509 |
"/ #define TIFFTAG_FEDEX_EDR 34929 /* unknown use */ |
|
510 |
"/ #define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */ |
|
511 |
||
512 |
"/ |
|
513 |
"/ Adobe Digital Negative (DNG) format tags |
|
514 |
"/ |
|
515 |
||
516 |
"/ #define TIFFTAG_DNGVERSION 50706 /* &DNG version number */ |
|
517 |
"/ #define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */ |
|
518 |
"/ #define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */ |
|
519 |
"/ #define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model name */ |
|
520 |
"/ #define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space mapping */ |
|
521 |
"/ #define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */ |
|
522 |
"/ #define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */ |
|
523 |
"/ #define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for the BlackLevel tag */ |
|
524 |
"/ #define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */ |
|
525 |
"/ #define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level differences (columns) */ |
|
526 |
"/ #define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level differences (rows) */ |
|
527 |
"/ #define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding level */ |
|
528 |
"/ #define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */ |
|
529 |
"/ #define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image area */ |
|
530 |
"/ #define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image area */ |
|
531 |
"/ #define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space transformation matrix 1 */ |
|
532 |
"/ #define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space transformation matrix 2 */ |
|
533 |
"/ #define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */ |
|
534 |
"/ #define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */ |
|
535 |
"/ #define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction matrix 1 */ |
|
536 |
"/ #define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction matrix 2 */ |
|
537 |
"/ #define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw values*/ |
|
538 |
"/ #define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in linear reference space */ |
|
539 |
"/ #define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in x-y chromaticity coordinates */ |
|
540 |
"/ #define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero point */ |
|
541 |
"/ #define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */ |
|
542 |
"/ #define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of sharpening */ |
|
543 |
"/ #define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of the green pixels in the blue/green rows track the values of the green pixels in the red/green rows */ |
|
544 |
"/ #define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */ |
|
545 |
"/ #define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */ |
|
546 |
"/ #define TIFFTAG_LENSINFO 50736 /* info about the lens */ |
|
547 |
"/ #define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */ |
|
548 |
"/ #define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the camera's anti-alias filter */ |
|
549 |
"/ #define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */ |
|
550 |
"/ #define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */ |
|
551 |
"/ #define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote tag is safe to preserve along with the rest of the EXIF data */ |
|
552 |
"/ #define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */ |
|
553 |
"/ #define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */ |
|
554 |
"/ #define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */ |
|
555 |
"/ #define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for the raw image data */ |
|
556 |
"/ #define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original raw file */ |
|
557 |
"/ #define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original raw file */ |
|
558 |
"/ #define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels of the sensor */ |
|
559 |
"/ #define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates of fully masked pixels */ |
|
560 |
"/ #define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */ |
|
561 |
"/ #define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space into ICC profile space */ |
|
562 |
"/ #define TIFFTAG_CURRENTICCPROFILE 50833 /* & */ |
|
563 |
"/ #define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */ |
|
564 |
||
565 |
"/ /* tag 65535 is an undefined tag used by Eastman Kodak */ |
|
566 |
"/ #define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */ |
|
567 |
"/ |
|
568 |
"/ /* |
|
569 |
"/ * The following are ``pseudo tags'' that can be used to control |
|
570 |
"/ * codec-specific functionality. These tags are not written to file. |
|
571 |
"/ * Note that these values start at 0xffff+1 so that they'll never |
|
572 |
"/ * collide with Aldus-assigned tags. |
|
573 |
"/ * |
|
574 |
"/ * If you want your private pseudo tags ``registered'' (i.e. added to |
|
575 |
"/ * this file), please post a bug report via the tracking system at |
|
576 |
"/ * http://www.remotesensing.org/libtiff/bugs.html with the appropriate |
|
577 |
"/ * C definitions to add. |
|
578 |
"/ */ |
|
579 |
"/ #define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */ |
|
580 |
"/ #define FAXMODE_CLASSIC 0x0000 /* default, include RTC */ |
|
581 |
"/ #define FAXMODE_NORTC 0x0001 /* no RTC at end of data */ |
|
582 |
"/ #define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */ |
|
583 |
"/ #define FAXMODE_BYTEALIGN 0x0004 /* byte align row */ |
|
584 |
"/ #define FAXMODE_WORDALIGN 0x0008 /* word align row */ |
|
585 |
"/ #define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */ |
|
586 |
"/ #define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */ |
|
587 |
"/ /* Note: quality level is on the IJG 0-100 scale. Default value is 75 */ |
|
588 |
"/ #define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */ |
|
589 |
"/ #define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */ |
|
590 |
"/ #define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */ |
|
591 |
"/ #define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */ |
|
592 |
"/ #define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */ |
|
593 |
"/ #define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */ |
|
594 |
"/ /* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */ |
|
595 |
"/ #define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */ |
|
596 |
"/ #define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */ |
|
597 |
"/ #define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */ |
|
598 |
"/ #define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */ |
|
599 |
"/ #define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */ |
|
600 |
"/ #define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */ |
|
601 |
"/ #define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */ |
|
602 |
"/ #define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */ |
|
603 |
"/ /* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */ |
|
604 |
"/ #define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */ |
|
605 |
"/ #define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */ |
|
606 |
"/ #define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */ |
|
607 |
"/ #define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */ |
|
608 |
"/ #define DCSIMAGERFILTER_IR 0 /* infrared filter */ |
|
609 |
"/ #define DCSIMAGERFILTER_MONO 1 /* monochrome filter */ |
|
610 |
"/ #define DCSIMAGERFILTER_CFA 2 /* color filter array */ |
|
611 |
"/ #define DCSIMAGERFILTER_OTHER 3 /* other filter */ |
|
612 |
"/ #define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */ |
|
613 |
"/ #define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */ |
|
614 |
"/ #define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */ |
|
615 |
"/ #define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */ |
|
616 |
"/ #define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */ |
|
617 |
"/ #define TIFFTAG_DCSGAMMA 65554 /* gamma value */ |
|
618 |
"/ #define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */ |
|
619 |
"/ #define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */ |
|
620 |
"/ /* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */ |
|
621 |
"/ #define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */ |
|
622 |
"/ #define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */ |
|
623 |
"/ /* 65559 is allocated to Oceana Matrix <dev@oceana.com> */ |
|
624 |
"/ #define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */ |
|
625 |
"/ #define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */ |
|
626 |
"/ #define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */ |
|
627 |
"/ #define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */ |
|
628 |
"/ #define SGILOGDATAFMT_RAW 2 /* uninterpreted data */ |
|
629 |
"/ #define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */ |
|
630 |
"/ #define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/ |
|
631 |
"/ #define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/ |
|
632 |
"/ #define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */ |
|
633 |
"/ #define TIFFTAG_LZMAPRESET 65562 /* LZMA2 preset (compression level) */ |
|
634 |
"/ #define TIFFTAG_PERSAMPLE 65563 /* interface for per sample tags */ |
|
635 |
"/ #define PERSAMPLE_MERGED 0 /* present as a single value */ |
|
636 |
"/ #define PERSAMPLE_MULTI 1 /* present as multiple values */ |
|
637 |
||
638 |
"/ |
|
639 |
"/ EXIF tags |
|
640 |
"/ |
|
641 |
"/ #define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */ |
|
642 |
"/ #define EXIFTAG_FNUMBER 33437 /* F number */ |
|
643 |
"/ #define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */ |
|
644 |
"/ #define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */ |
|
645 |
"/ #define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */ |
|
646 |
"/ #define EXIFTAG_OECF 34856 /* Optoelectric conversion factor */ |
|
647 |
"/ #define EXIFTAG_EXIFVERSION 36864 /* Exif version */ |
|
648 |
"/ #define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original data generation */ |
|
649 |
"/ #define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital data generation */ |
|
650 |
"/ #define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */ |
|
651 |
"/ #define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */ |
|
652 |
"/ #define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */ |
|
653 |
"/ #define EXIFTAG_APERTUREVALUE 37378 /* Aperture */ |
|
654 |
"/ #define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */ |
|
655 |
"/ #define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */ |
|
656 |
"/ #define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */ |
|
657 |
"/ #define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */ |
|
658 |
"/ #define EXIFTAG_METERINGMODE 37383 /* Metering mode */ |
|
659 |
"/ #define EXIFTAG_LIGHTSOURCE 37384 /* Light source */ |
|
660 |
"/ #define EXIFTAG_FLASH 37385 /* Flash */ |
|
661 |
"/ #define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */ |
|
662 |
"/ #define EXIFTAG_SUBJECTAREA 37396 /* Subject area */ |
|
663 |
"/ #define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */ |
|
664 |
"/ #define EXIFTAG_USERCOMMENT 37510 /* User comments */ |
|
665 |
"/ #define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */ |
|
666 |
"/ #define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */ |
|
667 |
"/ #define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */ |
|
668 |
"/ #define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */ |
|
669 |
"/ #define EXIFTAG_COLORSPACE 40961 /* Color space information */ |
|
670 |
"/ #define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */ |
|
671 |
"/ #define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */ |
|
672 |
"/ #define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */ |
|
673 |
"/ #define EXIFTAG_FLASHENERGY 41483 /* Flash energy */ |
|
674 |
"/ #define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */ |
|
675 |
"/ #define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */ |
|
676 |
"/ #define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */ |
|
677 |
"/ #define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */ |
|
678 |
"/ #define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */ |
|
679 |
"/ #define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */ |
|
680 |
"/ #define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */ |
|
681 |
"/ #define EXIFTAG_FILESOURCE 41728 /* File source */ |
|
682 |
"/ #define EXIFTAG_SCENETYPE 41729 /* Scene type */ |
|
683 |
"/ #define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */ |
|
684 |
"/ #define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */ |
|
685 |
"/ #define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */ |
|
686 |
"/ #define EXIFTAG_WHITEBALANCE 41987 /* White balance */ |
|
687 |
"/ #define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */ |
|
688 |
"/ #define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */ |
|
689 |
"/ #define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */ |
|
690 |
"/ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ |
|
691 |
"/ #define EXIFTAG_CONTRAST 41992 /* Contrast */ |
|
692 |
"/ #define EXIFTAG_SATURATION 41993 /* Saturation */ |
|
693 |
"/ #define EXIFTAG_SHARPNESS 41994 /* Sharpness */ |
|
694 |
"/ #define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */ |
|
695 |
"/ #define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */ |
|
696 |
"/ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ |
|
697 |
"/ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ |
|
698 |
"/ #define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */ |
|
699 |
||
392
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
700 |
" |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
701 |
self initialize |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
702 |
" |
7729a280960c
handle bottom-to-top images (orientation==4)
Claus Gittinger <cg@exept.de>
parents:
359
diff
changeset
|
703 |
|
3986 | 704 |
"Modified: / 28-08-2017 / 00:46:15 / cg" |
28 | 705 |
! ! |
706 |
||
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
707 |
!TIFFReader class methodsFor:'testing'! |
3 | 708 |
|
135 | 709 |
canRepresent:anImage |
710 |
"return true, if anImage can be represented in my file format. |
|
711 |
Any image is supported." |
|
712 |
||
713 |
^ true |
|
714 |
! |
|
715 |
||
3 | 716 |
isValidImageFile:aFileName |
3984 | 717 |
"return true, if aFileName contains a TIFF image" |
718 |
||
719 |
|inStream bytes1_2 byte3 byte4 versionLow versionHi| |
|
3 | 720 |
|
11 | 721 |
inStream := self streamReadingFile:aFileName. |
3 | 722 |
inStream isNil ifTrue:[^ false]. |
723 |
||
3984 | 724 |
bytes1_2 := inStream next:2. |
725 |
byte3 := inStream nextByte. |
|
726 |
byte4 := inStream nextByte. |
|
727 |
inStream close. |
|
728 |
||
729 |
((bytes1_2 = 'II' "tiff") or:[bytes1_2 = 'PE' "mdi"]) ifTrue:[ |
|
730 |
"/ intel byte order (lsb) |
|
731 |
versionLow := byte3. versionHi := byte4. |
|
732 |
] ifFalse:[ |
|
733 |
((bytes1_2 = 'MM' "tiff") or:[bytes1_2 = 'EP' "mdi"]) ifTrue:[ |
|
734 |
"/ motorola byte order (msb) |
|
735 |
versionLow := byte4. versionHi := byte3. |
|
736 |
] ifFalse:[ |
|
737 |
^ false |
|
738 |
]. |
|
739 |
]. |
|
740 |
versionHi == 0 ifTrue:[ |
|
741 |
(versionLow == 42) ifTrue:[^ true]. "/ tiff |
|
742 |
(versionLow == 43) ifTrue:[^ true]. "/ bigtiff |
|
3 | 743 |
]. |
3984 | 744 |
^ false. |
745 |
||
746 |
"Modified: / 26-08-2017 / 15:31:08 / cg" |
|
747 |
! ! |
|
748 |
||
749 |
!TIFFReader methodsFor:'accessing'! |
|
750 |
||
751 |
decodeMetaTags:aBoolean |
|
752 |
"by default, extra meta tags (photoshop) are not decoded; |
|
753 |
set to true to get them in metatags" |
|
754 |
||
755 |
decodeMetaTags := aBoolean. |
|
756 |
||
757 |
"Modified (comment): / 27-08-2017 / 18:37:04 / cg" |
|
758 |
! |
|
759 |
||
760 |
loadFullResolutionImage:aBoolean |
|
761 |
"by default, the full-resolution dng image is not decoded; |
|
762 |
set to true to get it in the imageSequence" |
|
763 |
||
764 |
loadFullResolutionImage := aBoolean. |
|
765 |
||
766 |
"Created: / 27-08-2017 / 18:41:48 / cg" |
|
0 | 767 |
! ! |
768 |
||
1762 | 769 |
!TIFFReader methodsFor:'private-data reading'! |
0 | 770 |
|
3984 | 771 |
readAdobeDeflateTiffImageData |
772 |
^ self readDeflateTiffImageData |
|
773 |
||
774 |
"Created: / 26-08-2017 / 14:44:35 / cg" |
|
775 |
"Modified: / 27-08-2017 / 18:55:11 / cg" |
|
776 |
! |
|
777 |
||
135 | 778 |
readCCITT3RLETiffImageData |
1826 | 779 |
^ self fileFormatError:'ccitt G3 mod Huffman (rle) compression not implemented' |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
780 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
781 |
"Modified: / 3.2.1998 / 18:03:14 / cg" |
135 | 782 |
! |
783 |
||
784 |
readCCITT3RLEWTiffImageData |
|
1826 | 785 |
^ self fileFormatError:'ccitt G3 mod Huffman (rlew) compression not implemented'. |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
786 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
787 |
"Modified: / 3.2.1998 / 18:03:30 / cg" |
135 | 788 |
! |
789 |
||
790 |
readCCITTGroup3TiffImageData |
|
1826 | 791 |
"not really tested - all I got is a single fax from NeXT step" |
135 | 792 |
|
793 |
|bytesPerRow bitsPerRow compressedStrip nPlanes |
|
794 |
stripNr "{ Class: SmallInteger }" |
|
795 |
offset "{ Class: SmallInteger }" |
|
796 |
row "{ Class: SmallInteger }" |
|
3984 | 797 |
bytesPerStrip "{ Class: SmallInteger }" |
798 |
count dstIndex| |
|
135 | 799 |
|
800 |
nPlanes := samplesPerPixel. |
|
801 |
(nPlanes ~~ 1) ifTrue:[ |
|
3977 | 802 |
(nPlanes == 2) ifTrue:[ |
3984 | 803 |
(planarConfiguration ~~ PLANARCONFIG_SEPARATE) ifTrue:[ |
3977 | 804 |
^ self fileFormatError:'only separate planes are supported'. |
805 |
]. |
|
806 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
807 |
nPlanes := 1 |
|
808 |
] ifFalse:[ |
|
809 |
^ self fileFormatError:'only monochrome/greyscale ccitt3supported'. |
|
810 |
]. |
|
135 | 811 |
]. |
3984 | 812 |
stripRowCounts notNil ifTrue:[ |
813 |
^ self fileFormatError:'stripRowCounts not supported'. |
|
814 |
]. |
|
0 | 815 |
|
3977 | 816 |
"/ (rowsPerStrip ~~ 1) ifTrue:[ |
817 |
"/ ^ self fileFormatError:'currently require rowsPerStrip to be 1'. |
|
818 |
"/ ]. |
|
135 | 819 |
|
3977 | 820 |
"/ 'TIFFReader: decompressing CCITT-3 ...' infoPrintNL. |
135 | 821 |
|
822 |
bitsPerRow := width * (bitsPerSample at:1). |
|
823 |
bytesPerRow := bitsPerRow // 8. |
|
824 |
((bitsPerRow \\ 8) ~~ 0) ifTrue:[ |
|
335 | 825 |
bytesPerRow := bytesPerRow + 1 |
135 | 826 |
]. |
827 |
||
828 |
data := ByteArray new:(bytesPerRow * height). |
|
3977 | 829 |
|
830 |
"/ if the number of rows per strip is unknown (-1), |
|
831 |
"/ make it one big strip and decompress that |
|
832 |
rowsPerStrip = 16rFFFFFFFF ifTrue:[ |
|
3984 | 833 |
self assert:(stripByteCounts size == 1). |
834 |
count := stripByteCounts sum. |
|
835 |
compressedStrip := ByteArray uninitializedNew:count. |
|
3977 | 836 |
self positionToStrip:1. |
3984 | 837 |
|
838 |
(inStream nextBytes:count into:compressedStrip) == count ifFalse:[ |
|
839 |
self error:'short read' |
|
840 |
]. |
|
841 |
||
842 |
compressedStrip := compressedStrip copyFrom:16r227. |
|
843 |
||
844 |
dstIndex := self class |
|
845 |
_decompressCCITT3From:compressedStrip |
|
846 |
count:count |
|
847 |
into:data |
|
848 |
startingAt:1. |
|
3977 | 849 |
^ self |
850 |
]. |
|
851 |
||
135 | 852 |
compressedStrip := ByteArray uninitializedNew:bytesPerRow. |
853 |
||
854 |
offset := 1. |
|
3984 | 855 |
stripNr := 1. |
135 | 856 |
|
857 |
row := 1. |
|
858 |
bytesPerStrip := bytesPerRow * rowsPerStrip. |
|
859 |
[row <= height] whileTrue:[ |
|
3984 | 860 |
self positionToStrip:stripNr. |
861 |
count := stripByteCounts at:stripNr. |
|
862 |
(inStream nextBytes:count into:compressedStrip) == count ifFalse:[ |
|
863 |
self error:'short read' |
|
864 |
]. |
|
865 |
dstIndex := self class |
|
866 |
_decompressCCITT3From:compressedStrip |
|
867 |
count:count |
|
868 |
into:data |
|
869 |
startingAt:offset |
|
870 |
count:width. "/ is this correct? - I think, that should be width*rowsPerStrip |
|
871 |
offset := offset + bytesPerStrip. |
|
872 |
row := row + rowsPerStrip. |
|
335 | 873 |
stripNr := stripNr + 1. |
135 | 874 |
] |
335 | 875 |
|
3984 | 876 |
" |
877 |
TIFFReader fromFile:'/Users/cg/DownloadsUnsaved/image_software/libtiffpic/g3test.tif' |
|
878 |
" |
|
879 |
||
880 |
"Modified: / 27-08-2017 / 15:37:51 / cg" |
|
135 | 881 |
! |
882 |
||
883 |
readCCITTGroup4TiffImageData |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
884 |
^ self fileFormatError:'ccitt group4 fax compression not implemented'. |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
885 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
886 |
"Modified: / 3.2.1998 / 18:04:34 / cg" |
135 | 887 |
! |
0 | 888 |
|
1826 | 889 |
readCCITTRLEWTiffImageData |
890 |
^ self fileFormatError:'ccitt mod Huffman (rlew) compression not implemented' |
|
891 |
! |
|
892 |
||
516 | 893 |
readDCSTiffImageData |
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
894 |
^ self fileFormatError:'dcs compression not implemented'. |
329
5fb99e0734e4
handle empty character-strings
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
895 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
896 |
"Modified: / 3.2.1998 / 18:04:44 / cg" |
135 | 897 |
! |
898 |
||
516 | 899 |
readDeflateTiffImageData |
3987 | 900 |
self readImageDataUsingDecompresor: |
901 |
[:inBytes :inCount :outBytes :outOffset :outCount | |
|
902 |
|zlibReader| |
|
903 |
||
904 |
zlibReader := ZipStream readOpenAsZipStreamOn:(inBytes readStream) suppressHeaderAndChecksum:false. |
|
905 |
zlibReader binary. |
|
906 |
zlibReader next:outCount into:outBytes startingAt:outOffset. |
|
907 |
outCount. |
|
908 |
]. |
|
909 |
||
910 |
"/ |bytesPerRowIn bytesPerRow nPlanes overAllBytes |
|
911 |
"/ bytesPerStrip "{ Class: SmallInteger }" |
|
912 |
"/ nBytes "{ Class: SmallInteger }" |
|
913 |
"/ stripNr "{ Class: SmallInteger }" |
|
914 |
"/ offset "{ Class: SmallInteger }" |
|
915 |
"/ row "{ Class: SmallInteger }" |
|
916 |
"/ zlibReader nread msb |
|
917 |
"/ convertFloats convertDoubles conversionBuffer| |
|
918 |
"/ |
|
919 |
"/ nPlanes := samplesPerPixel. |
|
920 |
"/ convertFloats := convertDoubles := false. |
|
921 |
"/ |
|
922 |
"/ (nPlanes >= 3) ifTrue:[ |
|
923 |
"/ bytesPerRowIn := width * ((bitsPerSample sum + 7) // 8). |
|
924 |
"/ (bitsPerSample conform:[:each | each == 8]) ifTrue:[ |
|
925 |
"/ sampleFormat == SAMPLEFORMAT_UINT ifFalse:[ |
|
926 |
"/ ^ self fileFormatError:'unsupported sample format'. |
|
927 |
"/ ]. |
|
928 |
"/ ] ifFalse:[ |
|
929 |
"/ sampleFormat == SAMPLEFORMAT_IEEEFP ifTrue:[ |
|
930 |
"/ nPlanes == 3 ifTrue:[ |
|
931 |
"/ (bitsPerSample conform:[:each | each == 64]) ifTrue:[ |
|
932 |
"/ convertDoubles := true. |
|
933 |
"/ bytesPerRow := width * nPlanes. |
|
934 |
"/ bitsPerSample := #(8 8 8). |
|
935 |
"/ ] ifFalse:[ |
|
936 |
"/ (bitsPerSample conform:[:each | each == 32]) ifTrue:[ |
|
937 |
"/ convertFloats := true. |
|
938 |
"/ bytesPerRow := width * nPlanes. |
|
939 |
"/ bitsPerSample := #(8 8 8). |
|
940 |
"/ ] ifFalse:[ |
|
941 |
"/ ^ self fileFormatError:'only 64/64/64 bits/sample are supported with IEEE_FP samples'. |
|
942 |
"/ ]. |
|
943 |
"/ ]. |
|
944 |
"/ ] ifFalse:[ |
|
945 |
"/ ^ self fileFormatError:'only support 3 planes with IEEE_FP sample format'. |
|
946 |
"/ ] |
|
947 |
"/ ] ifFalse:[ |
|
948 |
"/ ^ self fileFormatError:'unsupported sample format'. |
|
949 |
"/ ]. |
|
950 |
"/ ] |
|
951 |
"/ ] ifFalse:[ |
|
952 |
"/ (nPlanes == 2) ifTrue:[ |
|
953 |
"/ (planarConfiguration ~~ PLANARCONFIG_SEPARATE) ifTrue:[ |
|
954 |
"/ ^ self fileFormatError:'only separate planes are supported'. |
|
955 |
"/ ]. |
|
956 |
"/ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
957 |
"/ nPlanes := 1 |
|
958 |
"/ ]. |
|
959 |
"/ (nPlanes == 1) ifFalse:[ |
|
960 |
"/ ^ self fileFormatError:'unsupported nPlanes: ' , nPlanes printString, '; only 3-sample rgb / monochrome supported'. |
|
961 |
"/ ]. |
|
962 |
"/ bytesPerRowIn := (width * (bitsPerSample at:1) + 7) // 8. |
|
963 |
"/ ]. |
|
964 |
"/ stripRowCounts notNil ifTrue:[ |
|
965 |
"/ ^ self fileFormatError:'stripRowCounts not supported'. |
|
966 |
"/ ]. |
|
967 |
"/ |
|
968 |
"/ "/ 'TIFFReader: decompressing Deflate ...' infoPrintNL. |
|
969 |
"/ |
|
970 |
"/ bytesPerRow isNil ifTrue:[ bytesPerRow := bytesPerRowIn ]. |
|
971 |
"/ |
|
972 |
"/ overAllBytes := bytesPerRow * height. |
|
973 |
"/ data := ByteArray new:overAllBytes. |
|
974 |
"/ (convertFloats or:[convertDoubles]) ifTrue:[ |
|
975 |
"/ conversionBuffer := ByteArray new:(bytesPerRowIn * rowsPerStrip). |
|
976 |
"/ ]. |
|
977 |
"/ |
|
978 |
"/ offset := 1. |
|
979 |
"/ stripNr := 0. |
|
980 |
"/ |
|
981 |
"/ row := 1. |
|
982 |
"/ bytesPerStrip := bytesPerRow * rowsPerStrip. |
|
983 |
"/ |
|
984 |
"/ [row <= height] whileTrue:[ |
|
985 |
"/ stripNr := stripNr + 1. |
|
986 |
"/ self positionToStrip:stripNr. |
|
987 |
"/ nBytes := stripByteCounts at:stripNr. |
|
988 |
"/ |
|
989 |
"/ zlibReader := ZipStream readOpenAsZipStreamOn:inStream suppressHeaderAndChecksum:false. |
|
990 |
"/ zlibReader binary. |
|
991 |
"/ |
|
992 |
"/ conversionBuffer notNil ifTrue:[ |
|
993 |
"/ nread := zlibReader next:nBytes into:conversionBuffer startingAt:1. |
|
994 |
"/ msb := (byteOrder == #msb). |
|
995 |
"/ convertFloats ifTrue:[ |
|
996 |
"/ |i| |
|
997 |
"/ |
|
998 |
"/ self assert:(nread \\ 4) == 0. |
|
999 |
"/ i := 0. |
|
1000 |
"/ 1 to:nread-1 by:4 do:[:iF | |
|
1001 |
"/ |dVal byteVal| |
|
1002 |
"/ dVal := conversionBuffer floatAt:iF MSB:msb. |
|
1003 |
"/ "/ rescale from 0..1 to 0..255 |
|
1004 |
"/ byteVal := (dVal * 255) asInteger clampBetween:0 and:255. |
|
1005 |
"/ data at:offset+i put:byteVal. |
|
1006 |
"/ i := i + 1. |
|
1007 |
"/ ]. |
|
1008 |
"/ ] ifFalse:[ |
|
1009 |
"/ convertDoubles ifTrue:[ |
|
1010 |
"/ |i| |
|
1011 |
"/ |
|
1012 |
"/ self assert:(nread \\ 8) == 0. |
|
1013 |
"/ i := 0. |
|
1014 |
"/ 1 to:nread-1 by:8 do:[:iF | |
|
1015 |
"/ |dVal byteVal| |
|
1016 |
"/ dVal := conversionBuffer doubleAt:iF MSB:msb. |
|
1017 |
"/ "/ rescale from 0..1 to 0..255 |
|
1018 |
"/ byteVal := (dVal * 255) asInteger clampBetween:0 and:255. |
|
1019 |
"/ data at:offset+i put:byteVal. |
|
1020 |
"/ i := i + 1. |
|
1021 |
"/ ]. |
|
1022 |
"/ ] |
|
1023 |
"/ ]. |
|
1024 |
"/ ] ifFalse:[ |
|
1025 |
"/ nread := zlibReader next:nBytes into:data startingAt:offset. |
|
1026 |
"/ ]. |
|
1027 |
"/ |
|
1028 |
"/ offset := offset + bytesPerStrip. |
|
1029 |
"/ row := row + rowsPerStrip |
|
1030 |
"/ ]. |
|
1031 |
"/ |
|
1032 |
"/ (predictor ~~ 1) ifTrue:[ |
|
1033 |
"/ (predictor == 2) ifTrue:[ |
|
1034 |
"/ self class decodeDelta:nPlanes in:data width:width height:height |
|
1035 |
"/ ] ifFalse:[ |
|
1036 |
"/ ^ self fileFormatError:'unsupported predictor' |
|
1037 |
"/ ]. |
|
1038 |
"/ ] |
|
1039 |
||
1040 |
"Modified (format): / 28-08-2017 / 03:06:39 / cg" |
|
516 | 1041 |
! |
1042 |
||
3986 | 1043 |
readImageDataUsingDecompresor:decompressorBlock |
1044 |
|bytesPerRowIn bytesPerRow nPlanes overAllBytes |
|
1045 |
nBytes "{ Class: SmallInteger }" |
|
1046 |
stripNr "{ Class: SmallInteger }" |
|
1047 |
offset "{ Class: SmallInteger }" |
|
1048 |
row "{ Class: SmallInteger }" |
|
1049 |
msb |
|
1050 |
convert convertFloats convertDoubles convertHalfFloats |
|
3987 | 1051 |
swapInt16s convertFillOrder |
3986 | 1052 |
inBuffer conversionBuffer floats nDecompressed |
1053 |
rowsInThisStrip bytesInThisStrip| |
|
1054 |
||
1055 |
nPlanes := samplesPerPixel. |
|
1056 |
convert := convertFloats := convertDoubles := convertHalfFloats := false. |
|
3987 | 1057 |
swapInt16s := convertFillOrder := false. |
3986 | 1058 |
|
1059 |
(nPlanes >= 3) ifTrue:[ |
|
1060 |
(planarConfiguration ~~ PLANARCONFIG_CONTIG) ifTrue:[ |
|
1061 |
^ self fileFormatError:'only non separate planes are supported with 3 or 4 planes'. |
|
1062 |
]. |
|
3987 | 1063 |
(nPlanes > 4) ifTrue:[ |
1064 |
photometric == #cmyk ifTrue:[ |
|
1065 |
"/ ignore alpha |
|
1066 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
1067 |
nPlanes := samplesPerPixel := 4. |
|
1068 |
bitsPerSample := bitsPerSample copyTo:4. |
|
1069 |
]. |
|
1070 |
]. |
|
1071 |
||
3986 | 1072 |
bytesPerRowIn := width * ((bitsPerSample sum + 7) // 8). |
1073 |
sampleFormat == SAMPLEFORMAT_UINT ifTrue:[ |
|
1074 |
(bitsPerSample conform:[:each | each == 8]) ifTrue:[ |
|
1075 |
"/ ok |
|
1076 |
] ifFalse:[ |
|
1077 |
(bitsPerSample conform:[:each | each == 16]) ifTrue:[ |
|
1078 |
"/ ok |
|
1079 |
] ifFalse:[ |
|
1080 |
^ self fileFormatError:'only 8 or 16 bits/channel are supported'. |
|
1081 |
] |
|
1082 |
]. |
|
1083 |
] ifFalse:[ |
|
1084 |
sampleFormat == SAMPLEFORMAT_IEEEFP ifTrue:[ |
|
1085 |
nPlanes == 3 ifTrue:[ |
|
1086 |
(bitsPerSample conform:[:each | each == 64]) ifTrue:[ |
|
1087 |
convertDoubles := convert := true. |
|
1088 |
bytesPerRow := width * nPlanes. |
|
1089 |
bitsPerSample := #(8 8 8). |
|
1090 |
] ifFalse:[ |
|
1091 |
(bitsPerSample conform:[:each | each == 32]) ifTrue:[ |
|
1092 |
convertFloats := convert := true. |
|
1093 |
bytesPerRow := width * nPlanes. |
|
1094 |
bitsPerSample := #(8 8 8). |
|
1095 |
] ifFalse:[ |
|
1096 |
(bitsPerSample conform:[:each | each == 16]) ifTrue:[ |
|
1097 |
convertHalfFloats := convert := true. |
|
1098 |
bytesPerRow := width * nPlanes. |
|
1099 |
bitsPerSample := #(8 8 8). |
|
1100 |
] ifFalse:[ |
|
1101 |
^ self fileFormatError:'only 16, 32 or 64 bits/sample are supported with IEEE_FP samples'. |
|
1102 |
]. |
|
1103 |
]. |
|
1104 |
]. |
|
1105 |
] ifFalse:[ |
|
1106 |
^ self fileFormatError:'only support 3 planes with IEEE_FP sample format'. |
|
1107 |
] |
|
1108 |
] ifFalse:[ |
|
1109 |
^ self fileFormatError:'unsupported sample format'. |
|
1110 |
]. |
|
1111 |
] |
|
1112 |
] ifFalse:[ |
|
1113 |
(nPlanes == 2) ifTrue:[ |
|
1114 |
(planarConfiguration ~~ PLANARCONFIG_SEPARATE) ifTrue:[ |
|
1115 |
^ self fileFormatError:'only separate planes are supported with 2 planes'. |
|
1116 |
]. |
|
1117 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
1118 |
nPlanes := 1 |
|
1119 |
]. |
|
1120 |
(nPlanes == 1) ifFalse:[ |
|
1121 |
^ self fileFormatError:'unsupported nPlanes: ' , nPlanes printString, '; only 3-sample rgb / monochrome supported'. |
|
1122 |
]. |
|
1123 |
bytesPerRowIn := (width * (bitsPerSample at:1) + 7) // 8. |
|
1124 |
(bitsPerSample at:1) == 16 ifTrue:[ |
|
3987 | 1125 |
byteOrder ~~ #msb ifTrue:[ |
3989 | 1126 |
"/ swapInt16s := true. |
3987 | 1127 |
]. |
3986 | 1128 |
]. |
1129 |
]. |
|
1130 |
fillOrder ~~ #msb ifTrue:[ |
|
1131 |
(bitsPerSample conform:[:n | n == 8]) ifFalse:[ |
|
1132 |
^ self fileFormatError:'unsupported bitsPerSample with lsb fillOrder' |
|
1133 |
]. |
|
1134 |
convertFillOrder := true. |
|
1135 |
]. |
|
1136 |
||
1137 |
bytesPerRow isNil ifTrue:[ bytesPerRow := bytesPerRowIn ]. |
|
1138 |
||
1139 |
overAllBytes := bytesPerRow * height. |
|
1140 |
data := ByteArray new:overAllBytes. |
|
1141 |
convert ifTrue:[ |
|
1142 |
conversionBuffer := ByteArray new:(bytesPerRowIn * rowsPerStrip). |
|
1143 |
]. |
|
1144 |
||
1145 |
offset := 1. |
|
1146 |
stripNr := 1. |
|
1147 |
row := 1. |
|
1148 |
msb := (byteOrder == #msb). |
|
1149 |
||
1150 |
[row <= height] whileTrue:[ |
|
1151 |
self positionToStrip:stripNr. |
|
1152 |
nBytes := stripByteCounts at:stripNr. |
|
1153 |
rowsInThisStrip := stripRowCounts notNil |
|
1154 |
ifTrue:[stripRowCounts at:stripNr] |
|
1155 |
ifFalse:[rowsPerStrip]. |
|
1156 |
bytesInThisStrip := bytesPerRowIn * rowsInThisStrip. |
|
1157 |
||
1158 |
"/ don verify; the last strip is shorter |
|
1159 |
"/ compression == 1 ifTrue:[ |
|
1160 |
"/ self assert:( nBytes == (bytesPerRowIn * rowsInThisStrip) ). |
|
1161 |
"/ ]. |
|
1162 |
||
1163 |
conversionBuffer notNil ifTrue:[ |
|
1164 |
decompressorBlock notNil ifTrue:[ |
|
1165 |
inBuffer := ByteArray new:nBytes. |
|
1166 |
(inStream nextBytes:nBytes into:inBuffer startingAt:1) == nBytes ifFalse:[ |
|
1167 |
self fileFormatError:'short read' |
|
1168 |
]. |
|
1169 |
||
1170 |
nDecompressed := decompressorBlock |
|
1171 |
value:inBuffer value:nBytes |
|
1172 |
value:conversionBuffer value:1 |
|
1173 |
value:bytesInThisStrip. |
|
1174 |
] ifFalse:[ |
|
1175 |
(nDecompressed := inStream nextBytes:nBytes into:conversionBuffer startingAt:1) == nBytes ifFalse:[ |
|
1176 |
self fileFormatError:'short read' |
|
1177 |
]. |
|
1178 |
]. |
|
1179 |
convertFloats ifTrue:[ |
|
1180 |
self assert:(nDecompressed \\ 4) == 0. |
|
1181 |
floats := FloatArray new:(nDecompressed // 4). |
|
1182 |
] ifFalse:[ |
|
1183 |
convertDoubles ifTrue:[ |
|
1184 |
self assert:(nDecompressed \\ 8) == 0. |
|
1185 |
floats := DoubleArray new:(nDecompressed // 8). |
|
1186 |
] ifFalse:[ |
|
1187 |
convertHalfFloats ifTrue:[ |
|
1188 |
self assert:(nDecompressed \\ 2) == 0. |
|
1189 |
floats := HalfFloatArray new:(nDecompressed // 2). |
|
1190 |
]. |
|
1191 |
]. |
|
1192 |
]. |
|
1193 |
floats replaceBytesWith:conversionBuffer. |
|
1194 |
1 to:floats size do:[:i | |
|
1195 |
|dVal byteVal| |
|
1196 |
||
1197 |
dVal := floats at:i. |
|
1198 |
"/ rescale from 0..1 to 0..255 |
|
1199 |
byteVal := (dVal * 255) asInteger clampBetween:0 and:255. |
|
1200 |
data at:offset+i-1 put:byteVal. |
|
1201 |
]. |
|
1202 |
] ifFalse:[ |
|
1203 |
decompressorBlock notNil ifTrue:[ |
|
1204 |
inBuffer := ByteArray new:nBytes. |
|
1205 |
(inStream nextBytes:nBytes into:inBuffer startingAt:1) == nBytes ifFalse:[ |
|
1206 |
self fileFormatError:'short read' |
|
1207 |
]. |
|
1208 |
nDecompressed := decompressorBlock |
|
1209 |
value:inBuffer value:nBytes |
|
1210 |
value:data value:offset |
|
1211 |
value:bytesInThisStrip. |
|
1212 |
] ifFalse:[ |
|
1213 |
(inStream nextBytes:nBytes into:data startingAt:offset) == nBytes ifFalse:[ |
|
1214 |
self fileFormatError:'short read' |
|
1215 |
]. |
|
1216 |
]. |
|
1217 |
]. |
|
1218 |
||
1219 |
offset := offset + bytesInThisStrip. |
|
1220 |
row := row + rowsInThisStrip. |
|
1221 |
stripNr := stripNr + 1. |
|
1222 |
]. |
|
1223 |
||
3987 | 1224 |
swapInt16s ifTrue:[ |
3986 | 1225 |
data swapBytes |
1226 |
]. |
|
1227 |
convertFillOrder ifTrue:[ |
|
1228 |
1 to:data size do:[:i | |
|
1229 |
data at:i put:(data at:i) bitReversed8. |
|
1230 |
]. |
|
1231 |
]. |
|
1232 |
||
1233 |
(predictor ~~ 1) ifTrue:[ |
|
1234 |
(predictor == 2) ifTrue:[ |
|
1235 |
self class decodeDelta:nPlanes in:data width:width height:height |
|
1236 |
] ifFalse:[ |
|
1237 |
^ self fileFormatError:'unsupported predictor' |
|
1238 |
]. |
|
1239 |
]. |
|
1240 |
||
1241 |
"Created: / 27-08-2017 / 22:48:17 / cg" |
|
3989 | 1242 |
"Modified: / 28-08-2017 / 03:41:55 / cg" |
3986 | 1243 |
! |
1244 |
||
516 | 1245 |
readJBIGTiffImageData |
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1246 |
^ self fileFormatError:'jbig compression not implemented'. |
516 | 1247 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1248 |
"Modified: / 3.2.1998 / 18:05:04 / cg" |
135 | 1249 |
! |
1250 |
||
1251 |
readJPEGTiffImageData |
|
3984 | 1252 |
|nBytes compressedData| |
1253 |
||
1254 |
stripByteCounts size == 1 ifTrue:[ |
|
1255 |
"/ single strip |
|
1256 |
self positionToStrip:1. |
|
1257 |
nBytes := stripByteCounts at:1. |
|
1258 |
compressedData := ByteArray uninitializedNew:nBytes. |
|
1259 |
(inStream nextBytes:nBytes into:compressedData) == nBytes ifFalse:[ self error:'short read' ]. |
|
1260 |
"/ pngOrJPGImage := JPEGReader fromStream:compressedData readStream. |
|
1261 |
"/ self halt. |
|
1262 |
]. |
|
1263 |
stripRowCounts notNil ifTrue:[ |
|
1264 |
^ self fileFormatError:'stripRowCounts not supported'. |
|
1265 |
]. |
|
1266 |
||
1267 |
^ self fileFormatError:'jpeg (old) compression not implemented'. |
|
1268 |
||
1269 |
"Modified: / 27-08-2017 / 15:38:23 / cg" |
|
135 | 1270 |
! |
1271 |
||
1272 |
readLZWTiffImageData |
|
3986 | 1273 |
self readImageDataUsingDecompresor: |
1274 |
[:inBytes :inCount :outBytes :outOffset :outCount | |
|
1275 |
self class |
|
1276 |
decompressLZWFrom:inBytes count:inCount |
|
1277 |
into:outBytes startingAt:outOffset. |
|
1278 |
outCount. |
|
1279 |
]. |
|
1280 |
||
1281 |
"/ "read LZW compressed tiff data; |
|
1282 |
"/ this method only handles 8+8+8 and 8+8+8+8 rgb |
|
1283 |
"/ and 2bit or 2+2bit greyscale images. |
|
1284 |
"/ For 2+2bit greyscale images, the alpha plane is ignored. |
|
1285 |
"/ (maybe other formats work also - but simply not tested)" |
|
1286 |
"/ |
|
1287 |
"/ |bytesPerRow compressedStrip nPlanes overAllBytes |
|
1288 |
"/ bytesPerStrip "{ Class: SmallInteger }" |
|
1289 |
"/ nBytes "{ Class: SmallInteger }" |
|
1290 |
"/ prevSize "{ Class: SmallInteger }" |
|
1291 |
"/ stripNr "{ Class: SmallInteger }" |
|
1292 |
"/ offset "{ Class: SmallInteger }" |
|
1293 |
"/ row "{ Class: SmallInteger }" | |
|
1294 |
"/ |
|
1295 |
"/ nPlanes := samplesPerPixel. |
|
1296 |
"/ |
|
1297 |
"/ (nPlanes >= 3) ifTrue:[ |
|
1298 |
"/ (bitsPerSample conform:[:each | each == 8]) ifFalse:[ |
|
1299 |
"/ ^ self fileFormatError:'only 8/8/8(/8) bits/sample are supported'. |
|
1300 |
"/ ]. |
|
1301 |
"/ bytesPerRow := width * samplesPerPixel. |
|
1302 |
"/ ] ifFalse:[ |
|
1303 |
"/ (nPlanes == 2) ifTrue:[ |
|
1304 |
"/ (planarConfiguration ~~ PLANARCONFIG_SEPARATE) ifTrue:[ |
|
1305 |
"/ ^ self fileFormatError:'only separate planes are supported'. |
|
1306 |
"/ ]. |
|
1307 |
"/ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
1308 |
"/ nPlanes := 1 |
|
1309 |
"/ ]. |
|
1310 |
"/ (nPlanes == 1) ifFalse:[ |
|
1311 |
"/ ^ self fileFormatError:'unsupported nPlanes: ' , nPlanes printString, '; only 3-sample rgb / monochrome supported'. |
|
1312 |
"/ ]. |
|
1313 |
"/ bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8. |
|
1314 |
"/ ]. |
|
1315 |
"/ stripRowCounts notNil ifTrue:[ |
|
1316 |
"/ ^ self fileFormatError:'stripRowCounts not supported'. |
|
1317 |
"/ ]. |
|
1318 |
"/ |
|
1319 |
"/ "/ 'TIFFReader: decompressing LZW ...' infoPrintNL. |
|
1320 |
"/ |
|
1321 |
"/ overAllBytes := bytesPerRow * height. |
|
1322 |
"/ bytesPerRow == width ifTrue:[ |
|
1323 |
"/ data := ByteArray uninitializedNew:overAllBytes. |
|
1324 |
"/ ] ifFalse:[ |
|
1325 |
"/ data := ByteArray new:overAllBytes. |
|
1326 |
"/ ]. |
|
1327 |
"/ |
|
1328 |
"/ offset := 1. |
|
1329 |
"/ stripNr := 0. |
|
1330 |
"/ |
|
1331 |
"/ row := 1. |
|
1332 |
"/ bytesPerStrip := bytesPerRow * rowsPerStrip. |
|
1333 |
"/ prevSize := 0. |
|
1334 |
"/ [row <= height] whileTrue:[ |
|
1335 |
"/ stripNr := stripNr + 1. |
|
1336 |
"/ self positionToStrip:stripNr. |
|
1337 |
"/ nBytes := stripByteCounts at:stripNr. |
|
1338 |
"/ (nBytes > prevSize) ifTrue:[ |
|
1339 |
"/ compressedStrip := ByteArray uninitializedNew:nBytes. |
|
1340 |
"/ prevSize := nBytes |
|
1341 |
"/ ]. |
|
1342 |
"/ (inStream nextBytes:nBytes into:compressedStrip) == nBytes ifFalse:[ self fileFormatError:'short file' ]. |
|
1343 |
"/ self class |
|
1344 |
"/ decompressLZWFrom:compressedStrip count:nBytes |
|
1345 |
"/ into:data startingAt:offset. |
|
1346 |
"/ offset := offset + bytesPerStrip. |
|
1347 |
"/ row := row + rowsPerStrip |
|
1348 |
"/ ]. |
|
1349 |
"/ |
|
1350 |
"/ predictor ~~ 1 ifTrue:[ |
|
1351 |
"/ (predictor == 2) ifTrue:[ |
|
1352 |
"/ self class decodeDelta:nPlanes in:data width:width height:height |
|
1353 |
"/ ] ifFalse:[ |
|
1354 |
"/ self fileFormatError:'unsupported predictor' |
|
1355 |
"/ ] |
|
1356 |
"/ ] |
|
1357 |
||
1358 |
"Modified: / 27-08-2017 / 22:58:36 / cg" |
|
135 | 1359 |
! |
1360 |
||
1361 |
readNeXTJPEGTiffImageData |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1362 |
^ self fileFormatError:'next jpeg compression not implemented'. |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1363 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1364 |
"Modified: / 3.2.1998 / 18:10:45 / cg" |
135 | 1365 |
! |
1366 |
||
1367 |
readNeXTRLE2TiffImageData |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1368 |
^ self fileFormatError:'next 2bit rle compression not implemented'. |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
1369 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1370 |
"Modified: / 3.2.1998 / 18:10:54 / cg" |
135 | 1371 |
! |
1372 |
||
1826 | 1373 |
readNewJPEGTiffImageData |
1374 |
^ self fileFormatError:'new jpeg compression not implemented'. |
|
1375 |
! |
|
1376 |
||
135 | 1377 |
readPackbitsTiffImageData |
3986 | 1378 |
self readImageDataUsingDecompresor: |
1379 |
[:inBytes :inCount :outBytes :outOffset :outCount | |
|
1380 |
self class decompressTiffPackBitsFrom:inBytes to:outBytes at:outOffset count:outCount. |
|
1381 |
]. |
|
1382 |
||
1383 |
"/ "this has only been tested with monochrome images" |
|
1384 |
"/ |
|
1385 |
"/ |bytesPerRow bitsPerRow nPlanes |
|
1386 |
"/ stripNr "{ Class: SmallInteger }" |
|
1387 |
"/ offset "{ Class: SmallInteger }" |
|
1388 |
"/ row "{ Class: SmallInteger }" |
|
1389 |
"/ nBytes "{ Class: SmallInteger }" bitsPerPixel overAllBytes buffer| |
|
1390 |
"/ |
|
1391 |
"/ nPlanes := samplesPerPixel. |
|
1392 |
"/ |
|
1393 |
"/ "only support 1-sample/pixel, |
|
1394 |
"/ with alpha - if separate planes, |
|
1395 |
"/ or rgb - if non separate planes and no alpha" |
|
1396 |
"/ |
|
1397 |
"/ (nPlanes == 2) ifTrue:[ |
|
1398 |
"/ (planarConfiguration ~~ PLANARCONFIG_SEPARATE) ifTrue:[ |
|
1399 |
"/ ^ self fileFormatError:'with alpha, only separate planes supported'. |
|
1400 |
"/ ]. |
|
1401 |
"/ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
1402 |
"/ nPlanes := 1. |
|
1403 |
"/ bitsPerPixel := bitsPerSample at:1. |
|
1404 |
"/ bitsPerSample := Array with:bitsPerPixel. |
|
1405 |
"/ samplesPerPixel := 1. |
|
1406 |
"/ ] ifFalse:[ |
|
1407 |
"/ (nPlanes == 3) ifTrue:[ |
|
1408 |
"/ (planarConfiguration ~~ PLANARCONFIG_CONTIG) ifTrue:[ |
|
1409 |
"/ ^ self fileFormatError:'only non separate planes supported'. |
|
1410 |
"/ ]. |
|
1411 |
"/ bitsPerSample ~= #(8 8 8) ifTrue:[ |
|
1412 |
"/ ^ self fileFormatError:'only 8/8/8 rgb images supported'. |
|
1413 |
"/ ]. |
|
1414 |
"/ bitsPerPixel := 24 |
|
1415 |
"/ ] ifFalse:[ |
|
1416 |
"/ (nPlanes ~~ 1) ifTrue:[ |
|
1417 |
"/ ^ self fileFormatError:('format (nplanes == %1) not supported' bindWith:nPlanes). |
|
1418 |
"/ ]. |
|
1419 |
"/ bitsPerPixel := bitsPerSample at:1. |
|
1420 |
"/ ] |
|
1421 |
"/ ]. |
|
1422 |
"/ stripRowCounts notNil ifTrue:[ |
|
1423 |
"/ ^ self fileFormatError:'stripRowCounts not supported'. |
|
1424 |
"/ ]. |
|
1425 |
"/ |
|
1426 |
"/ bitsPerRow := width * bitsPerPixel. |
|
1427 |
"/ bytesPerRow := bitsPerRow // 8. |
|
1428 |
"/ ((bitsPerRow \\ 8) ~~ 0) ifTrue:[ |
|
1429 |
"/ bytesPerRow := bytesPerRow + 1 |
|
1430 |
"/ ]. |
|
1431 |
"/ |
|
1432 |
"/ overAllBytes := bytesPerRow * height. |
|
1433 |
"/ bytesPerRow == width ifTrue:[ |
|
1434 |
"/ data := ByteArray uninitializedNew:overAllBytes. |
|
1435 |
"/ ] ifFalse:[ |
|
1436 |
"/ data := ByteArray new:overAllBytes. |
|
1437 |
"/ ]. |
|
1438 |
"/ |
|
1439 |
"/ offset := 1. |
|
1440 |
"/ stripNr := 1. |
|
1441 |
"/ |
|
1442 |
"/ buffer := nil. |
|
1443 |
"/ row := 1. |
|
1444 |
"/ [row <= height] whileTrue:[ |
|
1445 |
"/ nBytes := stripByteCounts at:stripNr. |
|
1446 |
"/ self positionToStrip:stripNr. |
|
1447 |
"/ |
|
1448 |
"/ nBytes > buffer size ifTrue:[ |
|
1449 |
"/ "/ realloc |
|
1450 |
"/ buffer := ByteArray uninitializedNew:nBytes. |
|
1451 |
"/ ]. |
|
1452 |
"/ (inStream nextBytes:nBytes into:buffer) == nBytes ifFalse:[ |
|
1453 |
"/ self fileFormatError:'short file read' |
|
1454 |
"/ ]. |
|
1455 |
"/ self class decompressTiffPackBitsFrom:buffer to:data at:offset count:(bytesPerRow * rowsPerStrip). |
|
1456 |
"/ "/ nDecompressedBytes := self class decompressPackBits:nBytes from:buffer to:data startingAt:offset. |
|
1457 |
"/ |
|
1458 |
"/ offset := offset + (bytesPerRow * rowsPerStrip). |
|
1459 |
"/ row := row + rowsPerStrip. |
|
1460 |
"/ stripNr := stripNr + 1. |
|
1461 |
"/ ] |
|
1462 |
||
1463 |
"Modified: / 28-08-2017 / 00:24:21 / cg" |
|
135 | 1464 |
! |
1465 |
||
516 | 1466 |
readPixarFilmTiffImageData |
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1467 |
^ self fileFormatError:'pixar film compression not implemented'. |
135 | 1468 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1469 |
"Modified: / 3.2.1998 / 18:11:45 / cg" |
516 | 1470 |
! |
1471 |
||
1472 |
readPixarLogTiffImageData |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1473 |
^ self fileFormatError:'pixar log compression not implemented'. |
0 | 1474 |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
1475 |
"Modified: / 3.2.1998 / 18:11:53 / cg" |
516 | 1476 |
! |
135 | 1477 |
|
3977 | 1478 |
readSGI24TiffImageData |
1479 |
^ self fileFormatError:'SGI 24-bit Log Luminance encoding not implemented' . |
|
1480 |
||
1481 |
"Created: / 25-08-2017 / 11:17:25 / cg" |
|
1482 |
! |
|
1483 |
||
1484 |
readSGI32TiffImageData |
|
1485 |
^ self fileFormatError:'SGI 32-bit Log Luminance encoding not implemented' . |
|
1486 |
||
1487 |
"Created: / 25-08-2017 / 11:17:21 / cg" |
|
1488 |
! |
|
1489 |
||
516 | 1490 |
readThunderScanTiffImageData |
3979 | 1491 |
|bytesPerRow compressedStrip nPlanes overAllBytes |
1492 |
bytesPerStrip "{ Class: SmallInteger }" |
|
1493 |
nBytes "{ Class: SmallInteger }" |
|
1494 |
prevSize "{ Class: SmallInteger }" |
|
1495 |
stripNr "{ Class: SmallInteger }" |
|
1496 |
offset "{ Class: SmallInteger }" |
|
1497 |
row "{ Class: SmallInteger }" |
|
1498 |
pixelIndex |
|
1499 |
i even gen highNibble lastPixel d1 d2 d3| |
|
1500 |
||
1501 |
nPlanes := samplesPerPixel. |
|
1502 |
||
1503 |
(nPlanes == 2) ifTrue:[ |
|
3984 | 1504 |
(planarConfiguration ~~ PLANARCONFIG_SEPARATE) ifTrue:[ |
3979 | 1505 |
^ self fileFormatError:'only separate planes are supported'. |
1506 |
]. |
|
1507 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
1508 |
nPlanes := 1 |
|
1509 |
]. |
|
1510 |
(nPlanes == 1) ifFalse:[ |
|
1511 |
^ self fileFormatError:'unsupported nPlanes: ' , nPlanes printString. |
|
1512 |
]. |
|
1513 |
(bitsPerSample at:1) == 4 ifFalse:[ |
|
1514 |
^ self fileFormatError:('unsupported bitsPerSample: %1 (only 4 supported)' bindWith:(bitsPerSample at:1)). |
|
1515 |
]. |
|
3984 | 1516 |
stripRowCounts notNil ifTrue:[ |
1517 |
^ self fileFormatError:'stripRowCounts not supported'. |
|
1518 |
]. |
|
1519 |
||
3979 | 1520 |
bytesPerRow := (width * (bitsPerSample at:1) + 7) // 8. |
1521 |
||
1522 |
"/ 'TIFFReader: decompressing ThunderScan ...' infoPrintNL. |
|
1523 |
||
1524 |
overAllBytes := bytesPerRow * height. |
|
1525 |
bytesPerRow == width ifTrue:[ |
|
1526 |
data := ByteArray uninitializedNew:overAllBytes. |
|
1527 |
] ifFalse:[ |
|
1528 |
data := ByteArray new:overAllBytes. |
|
1529 |
]. |
|
1530 |
||
1531 |
offset := 1. |
|
1532 |
stripNr := 0. |
|
1533 |
||
1534 |
gen := [:pixel | |
|
1535 |
even ifTrue:[ |
|
1536 |
highNibble := pixel. |
|
1537 |
even := false. |
|
1538 |
] ifFalse:[ |
|
1539 |
data at:pixelIndex put:((highNibble bitShift:4) bitOr:pixel). |
|
1540 |
pixelIndex := pixelIndex + 1. |
|
1541 |
even := true. |
|
1542 |
]. |
|
1543 |
]. |
|
1544 |
even := true. |
|
1545 |
lastPixel := 0. |
|
1546 |
||
1547 |
row := 1. |
|
1548 |
bytesPerStrip := bytesPerRow * rowsPerStrip. |
|
1549 |
prevSize := 0. |
|
1550 |
[row <= height] whileTrue:[ |
|
1551 |
stripNr := stripNr + 1. |
|
1552 |
self positionToStrip:stripNr. |
|
1553 |
nBytes := stripByteCounts at:stripNr. |
|
1554 |
(nBytes > prevSize) ifTrue:[ |
|
1555 |
compressedStrip := ByteArray uninitializedNew:nBytes. |
|
1556 |
prevSize := nBytes |
|
1557 |
]. |
|
1558 |
(inStream nextBytes:nBytes into:compressedStrip) == nBytes ifFalse:[ self error:'short read' ]. |
|
516 | 1559 |
|
3979 | 1560 |
"/ RLE decode... (see http://fileformats.archiveteam.org/wiki/ThunderScan_compression) |
1561 |
i := 1. |
|
1562 |
pixelIndex := offset. |
|
1563 |
||
1564 |
[i <= nBytes] whileTrue:[ |
|
1565 |
|code| |
|
1566 |
||
1567 |
code := compressedStrip at:i. |
|
1568 |
i := i + 1. |
|
1569 |
code >= 2r11000000 ifTrue:[ |
|
1570 |
"/ a single pixel |
|
1571 |
lastPixel := code bitAnd:2r00111111. |
|
1572 |
self assert:(lastPixel <= 2r1111). |
|
1573 |
||
1574 |
gen value:lastPixel. |
|
1575 |
] ifFalse:[ |
|
1576 |
code >= 2r10000000 ifTrue:[ |
|
1577 |
"/ three bit deltas (2 pixels) |
|
1578 |
||
1579 |
d1 := (code rightShift:3) bitAnd:2r111. |
|
1580 |
d2 := code bitAnd:2r111. |
|
1581 |
d1 ~~ 4 ifTrue:[ |
|
1582 |
lastPixel := lastPixel + (#(0 1 2 3 0 -3 -2 -1) at:d1+1). |
|
1583 |
gen value:lastPixel. |
|
1584 |
]. |
|
1585 |
d2 ~~ 4 ifTrue:[ |
|
1586 |
lastPixel := lastPixel + (#(0 1 2 3 0 -3 -2 -1) at:d2+1). |
|
1587 |
gen value:lastPixel. |
|
1588 |
]. |
|
1589 |
] ifFalse:[ |
|
1590 |
code >= 2r01000000 ifTrue:[ |
|
1591 |
"/ two bit deltas (3 pixels) |
|
1592 |
d1 := (code rightShift:4) bitAnd:2r11. |
|
1593 |
d2 := (code rightShift:2) bitAnd:2r11. |
|
1594 |
d3 := code bitAnd:2r11. |
|
1595 |
d1 ~~ 2 ifTrue:[ |
|
1596 |
lastPixel := lastPixel + (#(0 1 0 -1) at:d1+1). |
|
1597 |
gen value:lastPixel. |
|
1598 |
]. |
|
1599 |
d2 ~~ 2 ifTrue:[ |
|
1600 |
lastPixel := lastPixel + (#(0 1 0 -1) at:d2+1). |
|
1601 |
gen value:lastPixel. |
|
1602 |
]. |
|
1603 |
d3 ~~ 2 ifTrue:[ |
|
1604 |
lastPixel := lastPixel + (#(0 1 0 -1) at:d3+1). |
|
1605 |
gen value:lastPixel. |
|
1606 |
]. |
|
1607 |
] ifFalse:[ |
|
1608 |
code timesRepeat:[ gen value:lastPixel ]. |
|
1609 |
]. |
|
1610 |
]. |
|
1611 |
]. |
|
1612 |
]. |
|
1613 |
"/ self assert:(pixelIndex == (offset + bytesPerStrip)). |
|
1614 |
||
1615 |
offset := offset + bytesPerStrip. |
|
1616 |
row := row + rowsPerStrip |
|
1617 |
]. |
|
1618 |
||
1619 |
(predictor ~~ 1) ifTrue:[ |
|
1620 |
^ self fileFormatError:('unsupported predictor: %1' bindWith:predictor). |
|
1621 |
]. |
|
1622 |
||
3984 | 1623 |
"Modified: / 27-08-2017 / 15:38:47 / cg" |
516 | 1624 |
! |
135 | 1625 |
|
516 | 1626 |
readTiffImageData |
3984 | 1627 |
(compression == COMPRESSION_NONE " 1 " ) ifTrue:[ |
1628 |
self readUncompressedTiffImageData. |
|
1629 |
^ self |
|
516 | 1630 |
]. |
3984 | 1631 |
(compression == COMPRESSION_CCITTRLE " 2 ") ifTrue:[ |
1632 |
self readCCITT3RLETiffImageData. |
|
1633 |
^ self |
|
516 | 1634 |
]. |
3984 | 1635 |
(compression == COMPRESSION_CCITTFAX3 " 3 ") ifTrue:[ |
1636 |
self readCCITTGroup3TiffImageData. |
|
1637 |
^ self |
|
516 | 1638 |
]. |
3984 | 1639 |
(compression == COMPRESSION_CCITTFAX4 " 4 ") ifTrue:[ |
1640 |
self readCCITTGroup4TiffImageData. |
|
1641 |
^ self |
|
516 | 1642 |
]. |
3984 | 1643 |
(compression == COMPRESSION_LZW " 5 ") ifTrue:[ |
1644 |
self readLZWTiffImageData. |
|
1645 |
^ self |
|
516 | 1646 |
]. |
3984 | 1647 |
(compression == COMPRESSION_OJPEG " 6 ") ifTrue:[ |
1648 |
self readJPEGTiffImageData. |
|
1649 |
^ self |
|
1650 |
]. |
|
1651 |
(compression == COMPRESSION_JPEG " 7 ") ifTrue:[ |
|
1652 |
self readNewJPEGTiffImageData. |
|
1653 |
^ self |
|
516 | 1654 |
]. |
3984 | 1655 |
(compression == COMPRESSION_ADOBE_DEFLATE " 8 ") ifTrue:[ |
1656 |
self readAdobeDeflateTiffImageData. |
|
1657 |
^ self |
|
516 | 1658 |
]. |
1659 |
||
3984 | 1660 |
(compression == COMPRESSION_NEXT " 32766 ") ifTrue:[ |
1661 |
self readNeXTRLE2TiffImageData. |
|
1662 |
^ self |
|
516 | 1663 |
]. |
3984 | 1664 |
(compression == COMPRESSION_CCITTRLEW " 32771 ") ifTrue:[ |
1665 |
self readCCITTRLEWTiffImageData. |
|
1666 |
^ self |
|
135 | 1667 |
]. |
3984 | 1668 |
(compression == COMPRESSION_PACKBITS " 32773 ") ifTrue:[ |
1669 |
self readPackbitsTiffImageData. |
|
1670 |
^ self |
|
516 | 1671 |
]. |
3984 | 1672 |
(compression == COMPRESSION_THUNDERSCAN " 32809 ") ifTrue:[ |
1673 |
self readThunderScanTiffImageData. |
|
1674 |
^ self |
|
516 | 1675 |
]. |
3984 | 1676 |
(compression == COMPRESSION_PIXARFILM " 32908 ") ifTrue:[ |
1677 |
self readPixarFilmTiffImageData. |
|
1678 |
^ self |
|
516 | 1679 |
]. |
3984 | 1680 |
(compression == COMPRESSION_PIXARLOG " 32909 ") ifTrue:[ |
1681 |
self readPixarLogTiffImageData. |
|
1682 |
^ self |
|
516 | 1683 |
]. |
3984 | 1684 |
(compression == COMPRESSION_DEFLATE " 32946 ") ifTrue:[ |
1685 |
self readDeflateTiffImageData. |
|
1686 |
^ self |
|
516 | 1687 |
]. |
3984 | 1688 |
(compression == COMPRESSION_DCS " 32947 ") ifTrue:[ |
1689 |
self readDCSTiffImageData. |
|
1690 |
^ self |
|
516 | 1691 |
]. |
3984 | 1692 |
(compression == COMPRESSION_NEXT_JPEG " 32865 ") ifTrue:[ |
1693 |
self readNeXTJPEGTiffImageData. |
|
1694 |
^ self |
|
516 | 1695 |
]. |
3984 | 1696 |
(compression == COMPRESSION_JBIG " 34661 ") ifTrue:[ |
1697 |
self readJBIGTiffImageData. |
|
1698 |
^ self |
|
3977 | 1699 |
]. |
3984 | 1700 |
(compression == COMPRESSION_SGILOG " 34676 ") ifTrue:[ |
1701 |
self readSGI32TiffImageData. |
|
1702 |
^ self |
|
3977 | 1703 |
]. |
3984 | 1704 |
(compression == COMPRESSION_SGILOG24 " 34677 ") ifTrue:[ |
1705 |
self readSGI24TiffImageData. |
|
1706 |
^ self |
|
1707 |
]. |
|
1708 |
||
1709 |
self fileFormatError:('compression type ' , compression printString , ' not known'). |
|
516 | 1710 |
|
3977 | 1711 |
"Created: / 11-04-1997 / 00:19:44 / cg" |
3984 | 1712 |
"Modified: / 26-08-2017 / 21:46:56 / cg" |
135 | 1713 |
! |
1714 |
||
3979 | 1715 |
readTiledJPEGTiffImageData |
3984 | 1716 |
^ self fileFormatError:'tiled jpeg (old) compression not implemented'. |
3979 | 1717 |
|
1718 |
"Created: / 25-08-2017 / 16:27:28 / cg" |
|
3984 | 1719 |
"Modified: / 26-08-2017 / 13:39:04 / cg" |
3979 | 1720 |
! |
1721 |
||
3976 | 1722 |
readTiledLZWTiffImageData |
1723 |
^ self fileFormatError:'tiled LZW data not implemented' . |
|
1724 |
||
1725 |
"Created: / 25-08-2017 / 01:05:13 / cg" |
|
1726 |
! |
|
1727 |
||
3984 | 1728 |
readTiledNewJPEGTiffImageData |
1729 |
^ self fileFormatError:'tiled new jpeg compression not implemented'. |
|
1730 |
||
1731 |
"Created: / 26-08-2017 / 13:37:51 / cg" |
|
1732 |
! |
|
1733 |
||
3975 | 1734 |
readTiledTiffImageData |
3984 | 1735 |
(compression == COMPRESSION_NONE " 1 ") ifTrue:[ |
1736 |
self readTiledUncompressedTiffImageData. |
|
1737 |
^ self |
|
3975 | 1738 |
]. |
3984 | 1739 |
(compression == COMPRESSION_LZW " 5 ") ifTrue:[ |
1740 |
self readTiledLZWTiffImageData. |
|
1741 |
^ self |
|
3975 | 1742 |
]. |
3984 | 1743 |
(compression == COMPRESSION_OJPEG " 6 ") ifTrue:[ |
1744 |
self readTiledJPEGTiffImageData. |
|
1745 |
^ self |
|
3979 | 1746 |
]. |
3984 | 1747 |
(compression == COMPRESSION_JPEG " 7 ") ifTrue:[ |
1748 |
self readTiledNewJPEGTiffImageData. |
|
1749 |
^ self |
|
1750 |
]. |
|
1751 |
||
1752 |
self fileFormatError:('tiled compression type ' , compression printString , ' not supported'). |
|
3975 | 1753 |
|
1754 |
"Created: / 25-08-2017 / 00:19:14 / cg" |
|
3984 | 1755 |
"Modified: / 26-08-2017 / 13:39:15 / cg" |
3975 | 1756 |
! |
1757 |
||
1758 |
readTiledUncompressedTiffImageData |
|
3985 | 1759 |
|bytesPerRow "{ Class: SmallInteger }" |
1760 |
bitsPerRow "{ Class: SmallInteger }" |
|
1761 |
bytesPerTileRow "{ Class: SmallInteger }" |
|
1762 |
bitsPerTileRow "{ Class: SmallInteger }" |
|
3975 | 1763 |
nPlanes |
3985 | 1764 |
tileNr "{ Class: SmallInteger }" |
1765 |
"/ offset "{ Class: SmallInteger }" |
|
1766 |
"/ row "{ Class: SmallInteger }" |
|
1767 |
nBytes "{ Class: SmallInteger }" |
|
1768 |
bitsPerPixel "{ Class: SmallInteger }" |
|
1769 |
overAllBytes "{ Class: SmallInteger }" |
|
1770 |
where "{ Class: SmallInteger }" |
|
1771 |
x "{ Class: SmallInteger }" |
|
1772 |
y "{ Class: SmallInteger }" |
|
3976 | 1773 |
imageRowOffset "{ Class: SmallInteger }" |
1774 |
imageOffset "{ Class: SmallInteger }" |
|
1775 |
tileOffset "{ Class: SmallInteger }" |
|
1776 |
dataOffset "{ Class: SmallInteger }" |
|
3984 | 1777 |
tilePos tile tH tW tb| |
3976 | 1778 |
|
3975 | 1779 |
nPlanes := samplesPerPixel. |
1780 |
||
1781 |
"/ not all formats are supported here, |
|
1782 |
||
1783 |
(nPlanes == 2) ifTrue:[ |
|
3984 | 1784 |
(planarConfiguration ~~ PLANARCONFIG_SEPARATE) ifTrue:[ |
3975 | 1785 |
^ self fileFormatError:'with alpha, only separate planes supported'. |
1786 |
]. |
|
1787 |
'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
1788 |
nPlanes := 1. |
|
1789 |
bitsPerPixel := bitsPerSample at:1. |
|
1790 |
bitsPerSample := Array with:bitsPerPixel. |
|
1791 |
samplesPerPixel := 1. |
|
1792 |
] ifFalse:[ |
|
1793 |
(nPlanes == 4) ifTrue:[ |
|
3984 | 1794 |
(planarConfiguration ~~ PLANARCONFIG_CONTIG) ifTrue:[ |
3975 | 1795 |
^ self fileFormatError:'only non separate planes supported'. |
1796 |
]. |
|
1797 |
bitsPerSample ~= #(8 8 8 8) ifTrue:[ |
|
3985 | 1798 |
^ self fileFormatError:'only 8/8/8/8 images supported (is: ' , bitsPerSample printString , ')'. |
3975 | 1799 |
]. |
1800 |
bitsPerPixel := 32. |
|
1801 |
] ifFalse:[ |
|
1802 |
(nPlanes == 3) ifTrue:[ |
|
3984 | 1803 |
(planarConfiguration ~~ PLANARCONFIG_CONTIG) ifTrue:[ |
3975 | 1804 |
^ self fileFormatError:'only non separate planes supported'. |
1805 |
]. |
|
1806 |
bitsPerSample ~= #(8 8 8) ifTrue:[ |
|
3985 | 1807 |
^ self fileFormatError:'only 8/8/8 images supported (is: ' , bitsPerSample printString , ')'. |
3975 | 1808 |
]. |
1809 |
bitsPerPixel := 24 |
|
1810 |
] ifFalse:[ |
|
1811 |
(nPlanes ~~ 1) ifTrue:[ |
|
1812 |
^ self fileFormatError:('unsupported format: nplanes=' , nPlanes printString). |
|
1813 |
]. |
|
1814 |
bitsPerPixel := bitsPerSample at:1. |
|
1815 |
] |
|
1816 |
] |
|
1817 |
]. |
|
3984 | 1818 |
stripRowCounts notNil ifTrue:[ |
1819 |
^ self fileFormatError:'stripRowCounts not supported'. |
|
1820 |
]. |
|
3975 | 1821 |
|
1822 |
bitsPerRow := width * bitsPerPixel. |
|
3984 | 1823 |
bytesPerRow := (bitsPerRow + 7) // 8. |
3976 | 1824 |
|
1825 |
bitsPerTileRow := tileWidth * bitsPerPixel. |
|
3984 | 1826 |
bytesPerTileRow := (bitsPerTileRow + 7) // 8. |
3975 | 1827 |
|
3976 | 1828 |
overAllBytes := bytesPerRow * height. |
1829 |
data := ByteArray new:overAllBytes. |
|
1830 |
||
1831 |
tileNr := 1. |
|
3975 | 1832 |
where := -1. |
3976 | 1833 |
y := 0. |
1834 |
imageRowOffset := 1. |
|
1835 |
[ y < height ] whileTrue:[ |
|
3984 | 1836 |
tH := tileLength. |
1837 |
(y+tileLength) > height ifTrue:[ |
|
1838 |
tH := height - y. |
|
1839 |
]. |
|
3976 | 1840 |
x := 0. |
1841 |
imageOffset := imageRowOffset. |
|
1842 |
[ x < width ] whileTrue:[ |
|
1843 |
nBytes := tileByteCounts at:tileNr. |
|
1844 |
tilePos := tileOffsets at:tileNr. |
|
1845 |
tileNr := tileNr + 1. |
|
1846 |
||
1847 |
where ~~ tilePos ifTrue:[ |
|
1848 |
inStream position:tilePos. |
|
1849 |
where := tilePos. |
|
1850 |
]. |
|
1851 |
tile := ByteArray new:nBytes. |
|
1852 |
inStream nextBytes:nBytes into:tile startingAt:1 blockSize:4096. |
|
1853 |
||
1854 |
"/ copy the tile. |
|
1855 |
tileOffset := 1. |
|
1856 |
dataOffset := imageOffset. |
|
3984 | 1857 |
tW := tileWidth. |
1858 |
tb := bytesPerTileRow. |
|
1859 |
(x+tileWidth) > width ifTrue:[ |
|
1860 |
tW := width-x. |
|
3986 | 1861 |
tb := ((bitsPerPixel * tW) + 7) // 8. |
3984 | 1862 |
]. |
1863 |
1 to:tH do:[:yT | |
|
1864 |
data replaceFrom:dataOffset to:dataOffset+tb-1 with:tile startingAt:tileOffset. |
|
3976 | 1865 |
dataOffset := dataOffset + bytesPerRow. |
1866 |
tileOffset := tileOffset + bytesPerTileRow. |
|
1867 |
]. |
|
1868 |
||
1869 |
"/ offset := offset + nBytes. |
|
1870 |
"/ row := row + rowsPerStrip. |
|
1871 |
where := where + nBytes. |
|
1872 |
||
3984 | 1873 |
x := x + tW. |
3976 | 1874 |
imageOffset := imageOffset + bytesPerTileRow. |
3975 | 1875 |
]. |
3984 | 1876 |
y := y + tH. |
1877 |
imageRowOffset := imageRowOffset + (bytesPerRow*tH). |
|
3975 | 1878 |
]. |
1879 |
||
1880 |
"Created: / 25-08-2017 / 00:22:31 / cg" |
|
3986 | 1881 |
"Modified: / 28-08-2017 / 01:14:00 / cg" |
3975 | 1882 |
! |
1883 |
||
135 | 1884 |
readUncompressedTiffImageData |
3986 | 1885 |
self readImageDataUsingDecompresor:nil |
1886 |
||
1887 |
"/ |bytesPerRow "{ Class: SmallInteger }" |
|
1888 |
"/ bitsPerRow "{ Class: SmallInteger }" |
|
1889 |
"/ nPlanes |
|
1890 |
"/ stripNr "{ Class: SmallInteger }" |
|
1891 |
"/ offset "{ Class: SmallInteger }" |
|
1892 |
"/ row "{ Class: SmallInteger }" |
|
1893 |
"/ nBytes "{ Class: SmallInteger }" |
|
1894 |
"/ bitsPerPixel |
|
1895 |
"/ overAllBytes "{ Class: SmallInteger }" |
|
1896 |
"/ where "{ Class: SmallInteger }" |
|
1897 |
"/ stripPos |
|
1898 |
"/ convertFloats convertDoubles convertHalfFloats| |
|
1899 |
"/ |
|
1900 |
"/ nPlanes := samplesPerPixel. |
|
1901 |
"/ |
|
1902 |
"/ "/ not all formats are supported here, |
|
1903 |
"/ |
|
1904 |
"/ (nPlanes == 2) ifTrue:[ |
|
1905 |
"/ (planarConfiguration ~~ PLANARCONFIG_SEPARATE) ifTrue:[ |
|
1906 |
"/ ^ self fileFormatError:'with alpha, only separate planes supported'. |
|
1907 |
"/ ]. |
|
1908 |
"/ 'TIFFReader [info]: ignoring alpha plane' infoPrintCR. |
|
1909 |
"/ nPlanes := 1. |
|
1910 |
"/ bitsPerPixel := bitsPerSample at:1. |
|
1911 |
"/ bitsPerSample := Array with:bitsPerPixel. |
|
1912 |
"/ samplesPerPixel := 1. |
|
1913 |
"/ ] ifFalse:[ |
|
1914 |
"/ (nPlanes == 4) ifTrue:[ |
|
1915 |
"/ (planarConfiguration ~~ PLANARCONFIG_CONTIG) ifTrue:[ |
|
1916 |
"/ ^ self fileFormatError:'only non separate planes supported'. |
|
1917 |
"/ ]. |
|
1918 |
"/ bitsPerSample ~= #(8 8 8 8) ifTrue:[ |
|
1919 |
"/ bitsPerSample ~= #(16 16 16 16) ifTrue:[ |
|
1920 |
"/ ^ self fileFormatError:'only 8/8/8/8 and 16/16/16/16 images supported'. |
|
1921 |
"/ ]. |
|
1922 |
"/ ]. |
|
1923 |
"/ bitsPerPixel := bitsPerSample sum. |
|
1924 |
"/ ] ifFalse:[ |
|
1925 |
"/ (nPlanes == 3) ifTrue:[ |
|
1926 |
"/ (planarConfiguration ~~ 1) ifTrue:[ |
|
1927 |
"/ ^ self fileFormatError:'only non separate planes supported'. |
|
1928 |
"/ ]. |
|
1929 |
"/ bitsPerSample ~= #(8 8 8) ifTrue:[ |
|
1930 |
"/ bitsPerSample ~= #(16 16 16) ifTrue:[ |
|
1931 |
"/ ^ self fileFormatError:'only 8/8/8 and 16/16/16 images supported; is: ' , bitsPerSample printString. |
|
1932 |
"/ ]. |
|
1933 |
"/ ]. |
|
1934 |
"/ bitsPerPixel := bitsPerSample sum. |
|
1935 |
"/ ] ifFalse:[ |
|
1936 |
"/ (nPlanes ~~ 1) ifTrue:[ |
|
1937 |
"/ ^ self fileFormatError:('unsupported format: nplanes=' , nPlanes printString). |
|
1938 |
"/ ]. |
|
1939 |
"/ bitsPerPixel := bitsPerSample at:1. |
|
1940 |
"/ ] |
|
1941 |
"/ ] |
|
1942 |
"/ ]. |
|
1943 |
"/ stripRowCounts notNil ifTrue:[ |
|
1944 |
"/ ^ self fileFormatError:'stripRowCounts not supported'. |
|
1945 |
"/ ]. |
|
1946 |
"/ |
|
1947 |
"/ bitsPerRow := width * bitsPerPixel. |
|
1948 |
"/ bytesPerRow := bitsPerRow // 8. |
|
1949 |
"/ ((bitsPerRow \\ 8) ~~ 0) ifTrue:[ |
|
1950 |
"/ bytesPerRow := bytesPerRow + 1 |
|
1951 |
"/ ]. |
|
1952 |
"/ |
|
1953 |
"/ overAllBytes := bytesPerRow * height. |
|
1954 |
"/ bytesPerRow == width ifTrue:[ |
|
1955 |
"/ data := ByteArray uninitializedNew:overAllBytes. |
|
1956 |
"/ ] ifFalse:[ |
|
1957 |
"/ data := ByteArray new:overAllBytes. |
|
1958 |
"/ ]. |
|
1959 |
"/ |
|
1960 |
"/ offset := 0. |
|
1961 |
"/ stripNr := 0. |
|
1962 |
"/ where := -1. |
|
1963 |
"/ row := 1. |
|
1964 |
"/ [row <= height] whileTrue:[ |
|
1965 |
"/ stripNr := stripNr + 1. |
|
1966 |
"/ nBytes := stripByteCounts at:stripNr. |
|
1967 |
"/ stripPos := stripOffsets at:stripNr. |
|
1968 |
"/ where ~~ stripPos ifTrue:[ |
|
1969 |
"/ inStream position:stripPos. |
|
1970 |
"/ where := stripPos. |
|
1971 |
"/ ]. |
|
1972 |
"/ |
|
1973 |
"/ offset + nBytes > overAllBytes ifTrue:[ |
|
1974 |
"/ nBytes := overAllBytes - offset. |
|
1975 |
"/ ]. |
|
1976 |
"/ |
|
1977 |
"/ (inStream nextBytes:nBytes into:data startingAt:offset+1) == nBytes ifFalse:[ |
|
1978 |
"/ ^ self fileFormatError:'short read'. |
|
1979 |
"/ ]. |
|
1980 |
"/ |
|
1981 |
"/ offset := offset + nBytes. |
|
1982 |
"/ row := row + rowsPerStrip. |
|
1983 |
"/ where := where + nBytes. |
|
1984 |
"/ ]. |
|
1985 |
||
1986 |
"Modified: / 27-08-2017 / 22:48:27 / cg" |
|
440 | 1987 |
! ! |
1988 |
||
1762 | 1989 |
!TIFFReader methodsFor:'private-reading'! |
516 | 1990 |
|
3984 | 1991 |
decodePhotoshopImageResourceBlock:bytes |
1992 |
"8BIM is the signature for Photoshop Image Resource Block (IRB). |
|
1993 |
See http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_38034. |
|
1994 |
||
1995 |
This kind of information could be found in images such as TIFF, JPEG, Photoshop native image format etc. |
|
1996 |
It could also be found in non-image documents such as in PDF. |
|
1997 |
The structure of the IRB is as follows: |
|
1998 |
Each IRB block starts with 4 bytes signature which translates to string '8BIM.' |
|
1999 |
After that, is a 2 bytes unique identifier denoting the kind of resource for this IRB. |
|
2000 |
For example: |
|
2001 |
0x040c for thumbnail; |
|
2002 |
0x041a for slices; |
|
2003 |
0x0408 for grid information; |
|
2004 |
0x040f for ICC Profile etc. |
|
2005 |
||
2006 |
After the identifier is a variable length string for name. |
|
2007 |
The first byte of the string tells the length of the string (excluding the first length byte). |
|
2008 |
After the first byte comes the string itself. |
|
2009 |
There is a requirement that the length of the whole string (including the length byte) should be even. |
|
2010 |
Otherwise, pad one more byte after the string. |
|
2011 |
||
2012 |
The next 4 bytes specifies the size of the actual data for this resource block followed by the data with the specified length. |
|
2013 |
The total length of the data also should be an even number. So if the size of the data is odd, pad another one byte. |
|
2014 |
This finishes a whole 8BIM. |
|
2015 |
||
2016 |
There could be more than one IRBs but they all conform to the same structure as described above. |
|
2017 |
How to interpret the data depends on the unique identifier. |
|
2018 |
||
2019 |
Now let's see how the IRBs are include in images. |
|
2020 |
For a JPEG image, metadata could be present as one of the application (APPn) segment. |
|
2021 |
Since different application could use the same APPn segment to store it's own metadata, |
|
2022 |
there must be some kind of identifier to let the image reader know what kind of information is contained inside the APPn. |
|
2023 |
Photoshop uses APP13 as it's IRB container and the APP13 contains 'Photoshop 3.0' as it's identifier. |
|
2024 |
||
2025 |
For TIFF image which is tag based and arranged in a directory structure. |
|
2026 |
There is a private tag 16r8649 called 'PHOTOSHOP' to insert IRB information. |
|
2027 |
||
2028 |
0x03E8 (Obsolete--Photoshop 2.0 only ) Contains five 2-byte values: number of channels, rows, columns, depth, and mode |
|
2029 |
0x03E9 Macintosh print manager print info record |
|
2030 |
0x03EA Macintosh page format information. No longer read by Photoshop. (Obsolete) |
|
2031 |
0x03EB Obsolete--Photoshop 2.0 only ) Indexed color table |
|
2032 |
0x03ED ResolutionInfo structure. See Appendix A in Photoshop API Guide.pdf. |
|
2033 |
0x03EE Names of the alpha channels as a series of Pascal strings. |
|
2034 |
0x03EF (Obsolete) See ID 1077DisplayInfo structure. See Appendix A in Photoshop API Guide.pdf. |
|
2035 |
0x03F0 The caption as a Pascal string. |
|
2036 |
0x03F1 Border information. Contains a fixed number (2 bytes real, 2 bytes fraction) for the border width, and 2 bytes for border units (1 = inches, 2 = cm, 3 = points, 4 = picas, 5 = columns). |
|
2037 |
0x03F2 Background color. See See Color structure. |
|
2038 |
0x03F3 Print flags. A series of one-byte boolean values (see Page Setup dialog): labels, crop marks, color bars, registration marks, negative, flip, interpolate, caption, print flags. |
|
2039 |
0x03F4 Grayscale and multichannel halftoning information |
|
2040 |
0x03F5 Color halftoning information |
|
2041 |
0x03F6 Duotone halftoning information |
|
2042 |
0x03F7 Grayscale and multichannel transfer function |
|
2043 |
0x03F8 Color transfer functions |
|
2044 |
0x03F9 Duotone transfer functions |
|
2045 |
0x03FA Duotone image information |
|
2046 |
0x03FB Two bytes for the effective black and white values for the dot range |
|
2047 |
0x03FC (Obsolete) |
|
2048 |
0x03FD EPS options |
|
2049 |
0x03FE Quick Mask information. 2 bytes containing Quick Mask channel ID; 1- byte boolean indicating whether the mask was initially empty. |
|
2050 |
0x03FF (Obsolete) |
|
2051 |
0x0400 Layer state information. 2 bytes containing the index of target layer (0 = bottom layer). |
|
2052 |
0x0401 Working path (not saved). See See Path resource format. |
|
2053 |
0x0402 Layers group information. 2 bytes per layer containing a group ID for the dragging groups. Layers in a group have the same group ID. |
|
2054 |
0x0403 (Obsolete) |
|
2055 |
0x0404 IPTC-NAA record. Contains the File Info... information. See the documentation in the IPTC folder of the Documentation folder. |
|
2056 |
0x0405 Image mode for raw format files |
|
2057 |
0x0406 JPEG quality. Private. |
|
2058 |
0x0408 (Photoshop 4.0) Grid and guides information. See See Grid and guides resource format. |
|
2059 |
0x0409 (Photoshop 4.0) Thumbnail resource for Photoshop 4.0 only. See See Thumbnail resource format. |
|
2060 |
0x040A (Photoshop 4.0) Copyright flag. Boolean indicating whether image is copyrighted. Can be set via Property suite or by user in File Info... |
|
2061 |
0x040B (Photoshop 4.0) URL. Handle of a text string with uniform resource locator. Can be set via Property suite or by user in File Info... |
|
2062 |
0x040C (Photoshop 5.0) Thumbnail resource (supersedes resource 1033). See See Thumbnail resource format. |
|
2063 |
0x040D (Photoshop 5.0) Global Angle. 4 bytes that contain an integer between 0 and 359, which is the global lighting angle for effects layer. If not present, assumed to be 30. |
|
2064 |
0x040E (Obsolete) See ID 1073 below. (Photoshop 5.0) Color samplers resource. See See Color samplers resource format. |
|
2065 |
0x040F (Photoshop 5.0) ICC Profile. The raw bytes of an ICC (International Color Consortium) format profile. See ICC1v42_2006-05.pdf in the Documentation folder and icProfileHeader.h in Sample Code\Common\Includes . |
|
2066 |
0x0410 (Photoshop 5.0) Watermark. One byte. |
|
2067 |
0x0411 (Photoshop 5.0) ICC Untagged Profile. 1 byte that disables any assumed profile handling when opening the file. 1 = intentionally untagged. |
|
2068 |
0x0412 (Photoshop 5.0) Effects visible. 1-byte global flag to show/hide all the effects layer. Only present when they are hidden. |
|
2069 |
0x0413 (Photoshop 5.0) Spot Halftone. 4 bytes for version, 4 bytes for length, and the variable length data. |
|
2070 |
0x0414 (Photoshop 5.0) Document-specific IDs seed number. 4 bytes: Base value, starting at which layer IDs will be generated (or a greater value if existing IDs already exceed it). Its purpose is to avoid the case where we add layers, flatten, save, open, and then add more layers that end up with the same IDs as the first set. |
|
2071 |
0x0415 (Photoshop 5.0) Unicode Alpha Names. Unicode string |
|
2072 |
0x0416 (Photoshop 6.0) Indexed Color Table Count. 2 bytes for the number of colors in table that are actually defined |
|
2073 |
0x0417 (Photoshop 6.0) Transparency Index. 2 bytes for the index of transparent color, if any. |
|
2074 |
0x0419 (Photoshop 6.0) Global Altitude. 4 byte entry for altitude |
|
2075 |
0x041A (Photoshop 6.0) Slices. See See Slices resource format. |
|
2076 |
0x041B (Photoshop 6.0) Workflow URL. Unicode string |
|
2077 |
0x041C (Photoshop 6.0) Jump To XPEP. 2 bytes major version, 2 bytes minor version, 4 bytes count. Following is repeated for count: 4 bytes block size, 4 bytes key, if key = 'jtDd' , then next is a Boolean for the dirty flag; otherwise it's a 4 byte entry for the mod date. |
|
2078 |
0x041D (Photoshop 6.0) Alpha Identifiers. 4 bytes of length, followed by 4 bytes each for every alpha identifier. |
|
2079 |
0x041E (Photoshop 6.0) URL List. 4 byte count of URLs, followed by 4 byte long, 4 byte ID, and Unicode string for each count. |
|
2080 |
0x0421 (Photoshop 6.0) Version Info. 4 bytes version, 1 byte hasRealMergedData , Unicode string: writer name, Unicode string: reader name, 4 bytes file version. |
|
2081 |
0x0422 (Photoshop 7.0) EXIF data 1. See http://www.kodak.com/global/plugins/acrobat/en/service/digCam/exifStandard2.pdf |
|
2082 |
0x0423 (Photoshop 7.0) EXIF data 3. See http://www.kodak.com/global/plugins/acrobat/en/service/digCam/exifStandard2.pdf |
|
2083 |
0x0424 (Photoshop 7.0) XMP metadata. File info as XML description. See http://www.adobe.com/devnet/xmp/ |
|
2084 |
0x0425 (Photoshop 7.0) Caption digest. 16 bytes: RSA Data Security, MD5 message-digest algorithm |
|
2085 |
0x0426 (Photoshop 7.0) Print scale. 2 bytes style (0 = centered, 1 = size to fit, 2 = user defined). 4 bytes x location (floating point). 4 bytes y location (floating point). 4 bytes scale (floating point) |
|
2086 |
0x0428 (Photoshop CS) Pixel Aspect Ratio. 4 bytes (version = 1 or 2), 8 bytes double, x / y of a pixel. Version 2, attempting to correct values for NTSC and PAL, previously off by a factor of approx. 5%. |
|
2087 |
0x0429 (Photoshop CS) Layer Comps. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) |
|
2088 |
0x042A (Photoshop CS) Alternate Duotone Colors. 2 bytes (version = 1), 2 bytes count, following is repeated for each count: [ Color: 2 bytes for space followed by 4 * 2 byte color component ], following this is another 2 byte count, usually 256, followed by Lab colors one byte each for L, a, b. This resource is not read or used by Photoshop. |
|
2089 |
0x042B (Photoshop CS)Alternate Spot Colors. 2 bytes (version = 1), 2 bytes channel count, following is repeated for each count: 4 bytes channel ID, Color: 2 bytes for space followed by 4 * 2 byte color component. This resource is not read or used by Photoshop. |
|
2090 |
0x042D (Photoshop CS2) Layer Selection ID(s). 2 bytes count, following is repeated for each count: 4 bytes layer ID |
|
2091 |
0x042E (Photoshop CS2) HDR Toning information |
|
2092 |
0x042F (Photoshop CS2) Print info |
|
2093 |
0x0430 (Photoshop CS2) Layer Group(s) Enabled ID. 1 byte for each layer in the document, repeated by length of the resource. NOTE: Layer groups have start and end markers |
|
2094 |
0x0431 (Photoshop CS3) Color samplers resource. Also see ID 1038 for old format. See See Color samplers resource format. |
|
2095 |
0x0432 (Photoshop CS3) Measurement Scale. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) |
|
2096 |
0x0433 (Photoshop CS3) Timeline Information. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) |
|
2097 |
0x0434 (Photoshop CS3) Sheet Disclosure. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) |
|
2098 |
0x0435 (Photoshop CS3) DisplayInfo structure to support floating point clors. Also see ID 1007. See Appendix A in Photoshop API Guide.pdf . |
|
2099 |
0x0436 (Photoshop CS3) Onion Skins. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) |
|
2100 |
0x0438 (Photoshop CS4) Count Information. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the count in the document. See the Count Tool. |
|
2101 |
0x043A (Photoshop CS5) Print Information. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the current print settings in the document. The color management options. |
|
2102 |
0x043B (Photoshop CS5) Print Style. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the current print style in the document. The printing marks, labels, ornaments, etc. |
|
2103 |
0x043C (Photoshop CS5) Macintosh NSPrintInfo. Variable OS specific info for Macintosh. NSPrintInfo. It is recommened that you do not interpret or use this data. |
|
2104 |
0x043D (Photoshop CS5) Windows DEVMODE. Variable OS specific info for Windows. DEVMODE. It is recommened that you do not interpret or use this data. |
|
2105 |
0x043E (Photoshop CS6) Auto Save File Path. Unicode string. It is recommened that you do not interpret or use this data. |
|
2106 |
0x043F (Photoshop CS6) Auto Save Format. Unicode string. It is recommened that you do not interpret or use this data. |
|
2107 |
0x0440 (Photoshop CC) Path Selection State. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the current path selection state. |
|
2108 |
0x07D0-0x0BB6 Path Information (saved paths). See See Path resource format. |
|
2109 |
0x0BB7 Name of clipping path. See See Path resource format. |
|
2110 |
0x0BB8 (Photoshop CC) Origin Path Info. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the origin path data. |
|
2111 |
0x0FA0-0x1387 Plug-In resource(s). Resources added by a plug-in. See the plug-in API found in the SDK documentation |
|
2112 |
0x1B58 Image Ready variables. XML representation of variables definition |
|
2113 |
0x1B59 Image Ready data sets |
|
2114 |
0x1B5A Image Ready default selected state |
|
2115 |
0x1B5B Image Ready 7 rollover expanded state |
|
2116 |
0x1B5C Image Ready rollover expanded state |
|
2117 |
0x1B5D Image Ready save layer settings |
|
2118 |
0x1B5E Image Ready version |
|
2119 |
0x1F40 (Photoshop CS3) Lightroom workflow, if present the document is in the middle of a Lightroom workflow. |
|
2120 |
0x2710 Print flags information. 2 bytes version ( = 1), 1 byte center crop marks, 1 byte ( = 0), 4 bytes bleed width value, 2 bytes bleed width scale. |
|
2121 |
" |
|
2122 |
||
2123 |
|s id name len resource record| |
|
2124 |
||
2125 |
record := OrderedCollection new. |
|
2126 |
||
2127 |
s := bytes readStream. |
|
2128 |
[s atEnd] whileFalse:[ |
|
2129 |
(s next:4) asString = '8BIM' ifTrue:[ |
|
2130 |
id := s nextUnsignedInt16MSB. |
|
2131 |
name := s upTo:0. |
|
2132 |
name size odd ifFalse:[ s next ]. "/ padding |
|
2133 |
len := s nextUnsignedInt32MSB. |
|
2134 |
resource := s next:len. |
|
2135 |
Verbose == true ifTrue:[ |
|
2136 |
Transcript showCR:(' 8BIM-%1: %2' bindWith:(id hexPrintString:4) with:resource). |
|
2137 |
]. |
|
2138 |
record add:(Dictionary new |
|
2139 |
at:#id put:id; |
|
2140 |
at:#name put:name; |
|
2141 |
at:#resource put:resource; |
|
2142 |
yourself). |
|
2143 |
]. |
|
2144 |
]. |
|
2145 |
metaData at:#'PhotoshopIRB' put:record. |
|
2146 |
||
2147 |
"Created: / 27-08-2017 / 17:12:25 / cg" |
|
2148 |
"Modified: / 27-08-2017 / 18:14:56 / cg" |
|
2149 |
! |
|
2150 |
||
3979 | 2151 |
decodeTiffTag:tagType numberType:numberType length:length |
2152 |
|offset value valueArray |
|
2153 |
val scaleFactor rV gV bV |
|
2154 |
n "{ Class: SmallInteger }" |
|
2155 |
i2 "{ Class: SmallInteger }" |
|
2156 |
i3 "{ Class: SmallInteger }" | |
|
2157 |
||
2158 |
Verbose == true ifTrue:[ Logger info:'tiffTag: %1' with:tagType ]. |
|
2159 |
||
2160 |
(numberType == 3 "TIFF_SHORT") ifTrue:[ |
|
2161 |
"16 bit ushort" |
|
2162 |
valueArray := self readShorts:length signed:false. |
|
2163 |
value := valueArray at:1 |
|
2164 |
] ifFalse:[(numberType == 4 "TIFF_LONG") ifTrue:[ |
|
2165 |
"32 bit uinteger" |
|
2166 |
valueArray := self readLongs:length signed:false. |
|
2167 |
value := valueArray at:1 |
|
2168 |
] ifFalse:[(numberType == 2 "TIFF_ASCII") ifTrue:[ |
|
2169 |
"ascii characters" |
|
2170 |
value := self readChars:length |
|
2171 |
] ifFalse:[(numberType == 5 "TIFF_RATIONAL") ifTrue:[ |
|
2172 |
"64 (32+32) bit ufraction" |
|
2173 |
valueArray := self readFracts:length signed:false. |
|
2174 |
value := valueArray at:1 |
|
2175 |
] ifFalse:[(numberType == 1 "TIFF_BYTE") ifTrue:[ |
|
2176 |
"8bit uinteger" |
|
2177 |
value := self readBytes:length signed:false |
|
2178 |
] ifFalse:[(numberType == 6 "TIFF_SBYTE") ifTrue:[ |
|
2179 |
"TIFF6: 8bit signed integer" |
|
2180 |
value := self readBytes:length signed:true |
|
2181 |
] ifFalse:[(numberType == 8 "TIFF_SSHORT") ifTrue:[ |
|
2182 |
"TIFF6: 16bit signed integer" |
|
2183 |
valueArray := self readShorts:length signed:true. |
|
2184 |
value := valueArray at:1 |
|
2185 |
] ifFalse:[(numberType == 9 "TIFF_SLONG") ifTrue:[ |
|
2186 |
"TIFF6: 32bit signed integer" |
|
2187 |
valueArray := self readLongs:length signed:true. |
|
2188 |
value := valueArray at:1 |
|
2189 |
] ifFalse:[(numberType == 10 "TIFF_SRATIONAL") ifTrue:[ |
|
2190 |
"TIFF6: 64 (32+32) bit signed fraction" |
|
2191 |
valueArray := self readFracts:length signed:true. |
|
2192 |
value := valueArray at:1 |
|
2193 |
] ifFalse:[(numberType == 11 "TIFF_FLOAT") ifTrue:[ |
|
2194 |
"TIFF6: 32 bit IEEE float" |
|
2195 |
valueArray := self readFloats:length. |
|
2196 |
value := valueArray at:1 |
|
2197 |
] ifFalse:[(numberType == 12 "TIFF_DOUBLE") ifTrue:[ |
|
2198 |
"TIFF6: 64 bit IEEE double" |
|
2199 |
valueArray := self readDoubles:length. |
|
2200 |
value := valueArray at:1 |
|
2201 |
||
2202 |
] ifFalse:[(numberType == 7 "TIFF_UNDEFINED") ifTrue:[ |
|
2203 |
"8bit anything" |
|
2204 |
value := self readBytes:length signed:false |
|
2205 |
||
2206 |
"/ the following are preps for the propsed bigTiff format |
|
2207 |
] ifFalse:[(numberType == 16 "TIFF_LONG8") ifTrue:[ |
|
2208 |
"BIGTIFF: 8-byte unsigned integer" |
|
2209 |
valueArray := self readLong8s:length signed:false. |
|
2210 |
value := valueArray at:1. |
|
2211 |
] ifFalse:[(numberType == 17 "TIFF_SLONG8") ifTrue:[ |
|
2212 |
"BIGTIFF: 8-byte signed integer" |
|
2213 |
valueArray := self readLong8s:length signed:true. |
|
2214 |
value := valueArray at:1. |
|
2215 |
] ifFalse:[(numberType == 18 "TIFF_IFD8") ifTrue:[ |
|
2216 |
"BIGTIFF: 8-byte unsigned IFD offset" |
|
2217 |
valueArray := self readLong8s:length signed:false. |
|
2218 |
value := valueArray at:1. |
|
2219 |
] ifFalse:[ |
|
2220 |
isBigTiff ifTrue:[ |
|
2221 |
offset := (inStream nextInt64MSB:(byteOrder ~~ #lsb)) |
|
2222 |
] ifFalse:[ |
|
2223 |
offset := (inStream nextInt32MSB:(byteOrder ~~ #lsb)) |
|
2224 |
] |
|
2225 |
]]]]]]]]]]]]]]]. |
|
2226 |
||
2227 |
(tagType between:200 and:299) ifTrue:[ |
|
2228 |
(tagType == 254) ifTrue:[ |
|
2229 |
"/ New SubfileType |
|
2230 |
"/ REDUCEDIMAGE -> 1 |
|
2231 |
"/ PAGE -> 2 |
|
2232 |
"/ MASK -> 4 |
|
2233 |
"newSubFileType := value." |
|
2234 |
||
2235 |
"/ 'newSubfiletype ' print. value printNewline. |
|
2236 |
Verbose == true ifTrue:[ |
|
2237 |
Logger info:' newSubfiletype: %1' with:value |
|
2238 |
]. |
|
2239 |
^ self |
|
2240 |
]. |
|
2241 |
(tagType == 255) ifTrue:[ |
|
2242 |
"/ Old SubfileType |
|
2243 |
"/ IMAGE -> 1 |
|
2244 |
"/ REDUCEDIMAGE -> 2 |
|
2245 |
"/ PAGE -> 3 |
|
2246 |
subFileType := value. |
|
2247 |
||
2248 |
Verbose == true ifTrue:[ |
|
2249 |
Logger info:' oldSubfiletype: %1' with:value |
|
2250 |
]. |
|
2251 |
||
2252 |
^ self |
|
2253 |
]. |
|
2254 |
(tagType == 256) ifTrue:[ |
|
2255 |
"ImageWidth" |
|
2256 |
width := value. |
|
2257 |
||
2258 |
Verbose == true ifTrue:[ |
|
2259 |
Logger info:' width: %1' with:value |
|
2260 |
]. |
|
2261 |
||
2262 |
^ self |
|
2263 |
]. |
|
2264 |
(tagType == 257) ifTrue:[ |
|
2265 |
"ImageHeight" |
|
2266 |
height := value. |
|
2267 |
||
2268 |
Verbose == true ifTrue:[ |
|
2269 |
Logger info:' height: %1' with:value |
|
2270 |
]. |
|
2271 |
||
2272 |
^ self |
|
2273 |
]. |
|
2274 |
(tagType == 258) ifTrue:[ |
|
2275 |
"bitspersample" |
|
2276 |
bitsPerSample := valueArray. |
|
2277 |
||
2278 |
Verbose == true ifTrue:[ |
|
2279 |
Logger info:' bitspersample: %1' with:valueArray |
|
2280 |
]. |
|
2281 |
||
2282 |
^ self |
|
2283 |
]. |
|
2284 |
(tagType == 259) ifTrue:[ |
|
2285 |
"/ compression |
|
2286 |
"/ NONE -> 1 |
|
2287 |
"/ CCITTRLE -> 2 |
|
2288 |
"/ CCITTFAX3 -> 3 |
|
2289 |
"/ CCITTFAX4 -> 4 |
|
2290 |
"/ LZW -> 5 |
|
2291 |
"/ OJPEG -> 6 (old style jpeg) |
|
2292 |
"/ JPEG -> 7 (new style jpeg) |
|
2293 |
"/ ADOBE_DEFLATE -> 8 |
|
2294 |
"/ JBIG -> 9 (ITU-T T85) |
|
2295 |
"/ JBIG -> 10 (ITU-T T43) |
|
2296 |
||
2297 |
"/ NEXT -> 32766 (NeXT 2-bit encoding) |
|
2298 |
"/ CCITTRLEW -> 32771 |
|
2299 |
"/ PACKBITS -> 32773 |
|
2300 |
"/ THUNDERSCAN -> 32809 (ThunderScan 4-bit encoding) |
|
2301 |
"/ IT8CTPAD -> 32895 |
|
2302 |
"/ IT8LW -> 32896 |
|
2303 |
"/ IT8MP -> 32897 |
|
2304 |
"/ IT8BL -> 32898 |
|
2305 |
"/ PIXARFILM -> 32908 |
|
2306 |
"/ PIXARLOG -> 32909 (Pixar companded 11-bit ZIP encoding) |
|
2307 |
"/ DEFLATE -> 32946 (PKZIP-style Deflate encoding) |
|
2308 |
"/ DCS -> 32947 (kodac) |
|
2309 |
"/ JBIG -> 34661 |
|
2310 |
"/ SGI32 -> 34676 (SGI 32-bit Log Luminance encoding) |
|
2311 |
"/ SGI24 -> 34677 (SGI 24-bit Log Luminance encoding) |
|
2312 |
"/ JPEG2000 -> 34712 JPEG2000 |
|
2313 |
"/ NIKON_NEF -> 34713 |
|
2314 |
"/ JBIG2 -> 34715 |
|
2315 |
compression := value. |
|
2316 |
||
3984 | 2317 |
Verbose == true ifTrue:[ |
2318 |
|s| |
|
2319 |
s := (Dictionary withKeyValuePairs: |
|
2320 |
#( (1 uncompressed) |
|
2321 |
(2 CCITTRLE) |
|
2322 |
(3 CCITTFAX3) |
|
2323 |
(4 CCITTFAX4) |
|
2324 |
(5 LZW) |
|
2325 |
(6 OJPEG) |
|
2326 |
(7 JPEG) |
|
2327 |
(8 ADOBE_DEFLATE) |
|
2328 |
(9 JBIG_T85) |
|
2329 |
(10 JBIG_T43) |
|
2330 |
(32766 NEXT) |
|
2331 |
(32771 CCITTRLEW) |
|
2332 |
(32773 PACKBITS) |
|
2333 |
(32809 THUNDERSCAN) |
|
2334 |
(32895 IT8CTPAD) |
|
2335 |
(32896 IT8LW) |
|
2336 |
(32897 IT8MP) |
|
2337 |
(32898 IT8BL) |
|
2338 |
(32908 PIXARFILM) |
|
2339 |
(32909 PIXARLOG) |
|
2340 |
(32946 DEFLATE) |
|
2341 |
(32947 DCS) |
|
2342 |
(34661 JBIG) |
|
2343 |
(34676 SGI32) |
|
2344 |
(34677 SGI24) |
|
2345 |
(34712 JPEG2000) |
|
2346 |
(34713 NIKON_NEF) |
|
2347 |
(34715 JBIG2) |
|
2348 |
)) at:value ifAbsent:'???'. |
|
2349 |
Logger info:' compression: %1 (=%2)' with:value with:s. |
|
3979 | 2350 |
]. |
2351 |
^ self |
|
2352 |
]. |
|
3980 | 2353 |
|
3979 | 2354 |
(tagType == 262) ifTrue:[ |
2355 |
"photometric" |
|
3984 | 2356 |
|p| |
3979 | 2357 |
|
2358 |
(value between:0 and:10) ifTrue:[ |
|
3980 | 2359 |
p := |
3984 | 2360 |
#( |
3980 | 2361 |
whiteIs0 "/ 0 - grayscale or monochrome; faxes |
2362 |
blackIs0 "/ 1 - grayscale or monochrome; faxes |
|
2363 |
rgb "/ 2 |
|
2364 |
palette "/ 3 |
|
2365 |
transparencyMask "/ 4 |
|
2366 |
cmyk "/ 5 - color separations |
|
2367 |
YCbCr "/ 6 - CCIR 601 |
|
2368 |
nil "/ 7 |
|
2369 |
CIElab "/ 8 - 1976 CIE L*a*b* |
|
2370 |
ICClab "/ 9 - ICC L*a*b* |
|
2371 |
ITUlab "/ 10 - see ITO-T- Rec T42 (RFC 2301) |
|
2372 |
) at:(value + 1) |
|
3979 | 2373 |
] ifFalse:[ |
2374 |
(value == 32803) ifTrue:[ |
|
3980 | 2375 |
p := #ColorFilterArray "/ camera rw format |
3979 | 2376 |
]. |
2377 |
(value == 32844) ifTrue:[ |
|
3980 | 2378 |
p := #PixarLogL |
3979 | 2379 |
]. |
2380 |
(value == 32845) ifTrue:[ |
|
3980 | 2381 |
p := #PixarLogLuv |
3979 | 2382 |
]. |
2383 |
(value == 34892) ifTrue:[ |
|
3980 | 2384 |
p := #LinearRaw "/ camera rw format |
3979 | 2385 |
]. |
2386 |
]. |
|
3984 | 2387 |
photometric := p. |
3979 | 2388 |
Verbose == true ifTrue:[ |
3984 | 2389 |
Logger info:' photometric: %1 (=%2)' with:value with:photometric |
3979 | 2390 |
]. |
2391 |
^ self |
|
2392 |
]. |
|
2393 |
(tagType == 263) ifTrue:[ |
|
2394 |
"/ Thresholding |
|
2395 |
"/ BILEVEL -> 1 |
|
2396 |
"/ HALFTONE -> 2 |
|
2397 |
"/ ERRORDIFFUSE -> 3 |
|
2398 |
||
2399 |
"thresholding := value." |
|
2400 |
||
2401 |
"/ 'thresholding ' print. value printNewline. |
|
2402 |
||
2403 |
^ self |
|
2404 |
]. |
|
2405 |
(tagType == 264) ifTrue:[ |
|
2406 |
"CellWidth" |
|
2407 |
"/ 'cellWidth ' print. value printNewline. |
|
2408 |
metaData at:#CellWidth put:value. |
|
2409 |
^ self |
|
2410 |
]. |
|
2411 |
(tagType == 265) ifTrue:[ |
|
2412 |
"CellLength" |
|
2413 |
"/ 'cellLength ' print. value printNewline. |
|
2414 |
metaData at:#CellLength put:value. |
|
2415 |
^ self |
|
2416 |
]. |
|
2417 |
(tagType == 266) ifTrue:[ |
|
2418 |
"fillOrder" |
|
3986 | 2419 |
(value == FILLORDER_MSB2LSB ) ifTrue:[ |
3984 | 2420 |
fillOrder := #msb |
3979 | 2421 |
] ifFalse:[ |
3986 | 2422 |
(value == FILLORDER_LSB2MSB) ifTrue:[ |
3984 | 2423 |
fillOrder := #lsb |
2424 |
] ifFalse:[ |
|
2425 |
fillOrder := nil |
|
2426 |
] |
|
3979 | 2427 |
]. |
3984 | 2428 |
Verbose == true ifTrue:[ |
2429 |
Logger info:' fillorder: %1' with:value |
|
2430 |
]. |
|
3979 | 2431 |
^ self |
2432 |
]. |
|
2433 |
(tagType == 269) ifTrue:[ |
|
2434 |
"documentName - info only" |
|
2435 |
metaData at:#DocumentName put:value. |
|
3984 | 2436 |
Verbose == true ifTrue:[ |
2437 |
Logger info:' documentName: %1' with:value |
|
2438 |
]. |
|
3979 | 2439 |
^ self |
2440 |
]. |
|
2441 |
(tagType == 270) ifTrue:[ |
|
2442 |
"imageDescription - info only" |
|
2443 |
metaData at:#ImageDescription put:value. |
|
3984 | 2444 |
Verbose == true ifTrue:[ |
2445 |
Logger info:' imageDescription: %1' with:value |
|
2446 |
]. |
|
3979 | 2447 |
^ self |
2448 |
]. |
|
2449 |
(tagType == 271) ifTrue:[ |
|
2450 |
"make - info only" |
|
2451 |
metaData at:#Make put:value. |
|
2452 |
Verbose == true ifTrue:[ |
|
2453 |
Logger info:' make: %1' with:value |
|
2454 |
]. |
|
2455 |
^ self |
|
2456 |
]. |
|
2457 |
(tagType == 272) ifTrue:[ |
|
2458 |
"model - info only" |
|
2459 |
metaData at:#Model put:value. |
|
2460 |
Verbose == true ifTrue:[ |
|
3984 | 2461 |
Logger info:' model: %1' with:value |
3979 | 2462 |
]. |
2463 |
^ self |
|
2464 |
]. |
|
2465 |
(tagType == 273) ifTrue:[ |
|
2466 |
"stripOffsets" |
|
2467 |
stripOffsets := valueArray. |
|
2468 |
Verbose == true ifTrue:[ |
|
2469 |
Logger info:' stripOffsets: %1' with:valueArray |
|
2470 |
]. |
|
2471 |
^ self |
|
2472 |
]. |
|
2473 |
(tagType == 274) ifTrue:[ |
|
2474 |
"Orientation" |
|
2475 |
||
2476 |
orientation := |
|
2477 |
#( nil "/ 1 normal (topLeft) |
|
3984 | 2478 |
hFlip "/ 2 horizontal flip |
2479 |
hvFlip "/ 3 horizontal & vertical flip |
|
3979 | 2480 |
vFlip "/ 4 vertical flip |
3984 | 2481 |
rot90ccw "/ 5 rot 90' counter clock-wise |
2482 |
rot90 "/ 6 rot 90' clock-wise |
|
2483 |
rot90flip "/ 7 rot 90' & flip |
|
2484 |
rot90ccwFlip "/ 8 rot 90' ccw & flip |
|
3979 | 2485 |
) at:value ifAbsent:#unsupported. |
2486 |
metaData at:#Orientation put:value. |
|
2487 |
Verbose == true ifTrue:[ |
|
3984 | 2488 |
Logger info:' orientation: %1 (=%2)' with:value with:(orientation ? #normal) |
3979 | 2489 |
]. |
2490 |
^ self |
|
2491 |
]. |
|
2492 |
(tagType == 277) ifTrue:[ |
|
2493 |
samplesPerPixel := value. |
|
2494 |
Verbose == true ifTrue:[ |
|
2495 |
Logger info:' samplesperpixel: %1' with:value |
|
2496 |
]. |
|
2497 |
^ self |
|
2498 |
]. |
|
2499 |
(tagType == 278) ifTrue:[ |
|
2500 |
rowsPerStrip := value. |
|
2501 |
Verbose == true ifTrue:[ |
|
2502 |
Logger info:' rowsPerStrip: %1' with:value |
|
2503 |
]. |
|
2504 |
^ self |
|
2505 |
]. |
|
2506 |
(tagType == 279) ifTrue:[ |
|
2507 |
"stripbytecount" |
|
2508 |
stripByteCounts := valueArray. |
|
2509 |
"/ 'stripByteCounts Array(' print. |
|
2510 |
"/ stripByteCounts size print. |
|
2511 |
"/ ')' printNewline. |
|
2512 |
Verbose == true ifTrue:[ |
|
2513 |
Logger info:' stripByteCounts: %1' with:valueArray |
|
2514 |
]. |
|
2515 |
^ self |
|
2516 |
]. |
|
2517 |
(tagType == 280) ifTrue:[ |
|
3984 | 2518 |
"/ minSampleValue |
3979 | 2519 |
metaData at:#MinSampleValue put:value. |
3984 | 2520 |
Verbose == true ifTrue:[ |
2521 |
Logger info:' minSampleValue: %1' with:value |
|
2522 |
]. |
|
3979 | 2523 |
^ self |
2524 |
]. |
|
2525 |
(tagType == 281) ifTrue:[ |
|
3984 | 2526 |
"/ maxSampleValue |
3979 | 2527 |
metaData at:#MaxSampleValue put:value. |
3984 | 2528 |
Verbose == true ifTrue:[ |
2529 |
Logger info:' maxSampleValue: %1' with:value |
|
2530 |
]. |
|
3979 | 2531 |
^ self |
2532 |
]. |
|
2533 |
(tagType == 282) ifTrue:[ |
|
2534 |
"/ xResolution |
|
2535 |
metaData at:#ResolutionX put:value. |
|
2536 |
Verbose == true ifTrue:[ |
|
3984 | 2537 |
Logger info:' xResolution: %1 (%2)' with:value with:value asFloat |
3979 | 2538 |
]. |
2539 |
^ self |
|
2540 |
]. |
|
2541 |
(tagType == 283) ifTrue:[ |
|
2542 |
"/ yResolution |
|
2543 |
metaData at:#ResolutionY put:value. |
|
2544 |
Verbose == true ifTrue:[ |
|
3984 | 2545 |
Logger info:' yResolution: %1 (%2)' with:value with:value asFloat |
3979 | 2546 |
]. |
2547 |
^ self |
|
2548 |
]. |
|
2549 |
(tagType == 284) ifTrue:[ |
|
2550 |
(value == 1) ifTrue:[ |
|
3984 | 2551 |
planarConfiguration := PLANARCONFIG_CONTIG |
3979 | 2552 |
] ifFalse:[ |
2553 |
(value == 2) ifTrue:[ |
|
3984 | 2554 |
planarConfiguration := PLANARCONFIG_SEPARATE |
3979 | 2555 |
] ifFalse:[ |
2556 |
planarConfiguration := nil |
|
2557 |
] |
|
2558 |
]. |
|
2559 |
Verbose == true ifTrue:[ |
|
2560 |
Logger info:' planarConfiguration: %1' with:value |
|
2561 |
]. |
|
2562 |
^ self |
|
2563 |
]. |
|
2564 |
(tagType == 285) ifTrue:[ |
|
2565 |
"/ 'pageName ' print. value printNewline. |
|
2566 |
metaData at:#PageName put:value. |
|
2567 |
^ self |
|
2568 |
]. |
|
2569 |
(tagType == 286) ifTrue:[ |
|
3984 | 2570 |
"/ xPosition |
3979 | 2571 |
metaData at:#PositionX put:value. |
3984 | 2572 |
Verbose == true ifTrue:[ |
2573 |
Logger info:' xPosition: %1' with:value |
|
2574 |
]. |
|
3979 | 2575 |
^ self |
2576 |
]. |
|
2577 |
(tagType == 287) ifTrue:[ |
|
3984 | 2578 |
"/ yPosition |
3979 | 2579 |
metaData at:#PositionY put:value. |
3984 | 2580 |
Verbose == true ifTrue:[ |
2581 |
Logger info:' yPosition: %1' with:value |
|
2582 |
]. |
|
3979 | 2583 |
^ self |
2584 |
]. |
|
2585 |
(tagType == 288) ifTrue:[ |
|
2586 |
"/ 'freeOffsets ' print. value printNewline. |
|
2587 |
^ self |
|
2588 |
]. |
|
2589 |
(tagType == 289) ifTrue:[ |
|
2590 |
"/ 'freeByteCounts ' print. value printNewline. |
|
2591 |
^ self |
|
2592 |
]. |
|
2593 |
(tagType == 290) ifTrue:[ |
|
2594 |
"/ 'grayResponceUnit' print. value printNewline. |
|
2595 |
metaData at:#GrayResponceUnit put:value. |
|
2596 |
^ self |
|
2597 |
]. |
|
2598 |
(tagType == 291) ifTrue:[ |
|
2599 |
"/ 'grayResponceCurve' print. value printNewline. |
|
2600 |
metaData at:#GrayResponceCurve put:value. |
|
2601 |
^ self |
|
2602 |
]. |
|
2603 |
(tagType == 292) ifTrue:[ |
|
2604 |
"/ group3options (now called T4Options) |
|
2605 |
"/ 2DENCODING -> 1 |
|
2606 |
"/ UNCOMPRESSED -> 2 |
|
2607 |
"/ FILLBITS -> 4 |
|
2608 |
||
2609 |
group3options := value. |
|
3984 | 2610 |
Verbose == true ifTrue:[ |
2611 |
Logger info:' group3options: %1' with:value |
|
2612 |
]. |
|
3979 | 2613 |
^ self |
2614 |
]. |
|
2615 |
(tagType == 293) ifTrue:[ |
|
2616 |
"/ group4options (now called T6Options) |
|
2617 |
"/ UNCOMPRESSED -> 2 |
|
2618 |
||
3984 | 2619 |
"/ group4options := value. |
2620 |
Verbose == true ifTrue:[ |
|
2621 |
Logger info:' group4options: %1' with:value |
|
2622 |
]. |
|
3979 | 2623 |
^ self |
2624 |
]. |
|
2625 |
(tagType == 296) ifTrue:[ |
|
2626 |
"resolutionunit" |
|
2627 |
||
2628 |
"/ (value == 1) ifTrue:[ |
|
2629 |
"/ 'res-unit pixel' printNewline |
|
2630 |
"/ ] ifFalse:[ |
|
2631 |
"/ (value == 2) ifTrue:[ |
|
2632 |
"/ 'res-unit inch' printNewline |
|
2633 |
"/ ] ifFalse:[ |
|
2634 |
"/ (value == 3) ifTrue:[ |
|
2635 |
"/ 'res-unit mm' printNewline |
|
2636 |
"/ ] ifFalse:[ |
|
2637 |
"/ 'res-unit invalid' printNewline |
|
2638 |
"/ ] |
|
2639 |
"/ ] |
|
2640 |
"/ ]. |
|
2641 |
metaData at:#ResolutionUnit put:value. |
|
2642 |
Verbose == true ifTrue:[ |
|
2643 |
Logger info:' resolutionUnit: %1' with:value |
|
2644 |
]. |
|
2645 |
^ self |
|
2646 |
]. |
|
2647 |
(tagType == 297) ifTrue:[ |
|
2648 |
"/ 'pageNumber ' print. value printNewline. |
|
2649 |
metaData at:#PageNumber put:value. |
|
3984 | 2650 |
Verbose == true ifTrue:[ |
2651 |
Logger info:' PageNumber: %1' with:value |
|
2652 |
]. |
|
3979 | 2653 |
^ self |
2654 |
]. |
|
2655 |
]. |
|
2656 |
||
2657 |
(tagType between:300 and:399) ifTrue:[ |
|
2658 |
(tagType == 300) ifTrue:[ |
|
2659 |
"/ 'colorResponceUnit' print. value printNewline. |
|
2660 |
metaData at:#ColorResponceUnit put:value. |
|
2661 |
^ self |
|
2662 |
]. |
|
2663 |
(tagType == 301) ifTrue:[ |
|
2664 |
"/ 'colorResponceCurve' print. value printNewline. |
|
2665 |
metaData at:#ColorResponceCurve put:value. |
|
2666 |
^ self |
|
2667 |
]. |
|
2668 |
(tagType == 305) ifTrue:[ |
|
2669 |
"software - info only" |
|
3984 | 2670 |
metaData at:#Software put:value. |
3979 | 2671 |
Verbose == true ifTrue:[ |
3984 | 2672 |
Logger info:' software: %1' with:value |
3979 | 2673 |
]. |
2674 |
^ self |
|
2675 |
]. |
|
2676 |
(tagType == 306) ifTrue:[ |
|
2677 |
"dateTime - info only" |
|
3984 | 2678 |
metaData at:#DateTime put:value. |
3979 | 2679 |
Verbose == true ifTrue:[ |
3984 | 2680 |
Logger info:' dateTime: %1' with:value |
3979 | 2681 |
]. |
2682 |
^ self |
|
2683 |
]. |
|
2684 |
(tagType == 315) ifTrue:[ |
|
2685 |
"artist - info only" |
|
3984 | 2686 |
metaData at:#Artist put:value. |
3979 | 2687 |
Verbose == true ifTrue:[ |
3984 | 2688 |
Logger info:' artist: %1' with:value |
3979 | 2689 |
]. |
2690 |
^ self |
|
2691 |
]. |
|
2692 |
(tagType == 316) ifTrue:[ |
|
2693 |
"host computer - info only" |
|
3984 | 2694 |
metaData at:#HostComputer put:value. |
3979 | 2695 |
Verbose == true ifTrue:[ |
3984 | 2696 |
Logger info:' host: %1' with:value |
3979 | 2697 |
]. |
2698 |
^ self |
|
2699 |
]. |
|
2700 |
(tagType == 317) ifTrue:[ |
|
3984 | 2701 |
"/ predictor |
3979 | 2702 |
"/ 1 -> no predictor |
2703 |
"/ 2 -> horiz. difference (see tiff spec 6.0) |
|
2704 |
"/ 3 -> flt pnt (see adobe tech notes) |
|
2705 |
"/ 34892 -> horiz difference x2 |
|
2706 |
"/ 34893 -> horiz difference x4 |
|
2707 |
"/ 34894 -> flt pnt x2 |
|
2708 |
"/ 34895 -> flt pnt x4 |
|
2709 |
predictor := value. |
|
3984 | 2710 |
Verbose == true ifTrue:[ |
2711 |
Logger info:' predictor: %1' with:value |
|
2712 |
]. |
|
3979 | 2713 |
^ self |
2714 |
]. |
|
2715 |
(tagType == 318) ifTrue:[ |
|
3984 | 2716 |
"/ whitePoint |
3979 | 2717 |
metaData at:#WhitePoint put:value. |
2718 |
^ self |
|
2719 |
]. |
|
2720 |
(tagType == 319) ifTrue:[ |
|
3984 | 2721 |
"/ primaryChromatics |
3979 | 2722 |
metaData at:#PrimaryChromatics put:value. |
2723 |
^ self |
|
2724 |
]. |
|
2725 |
(tagType == 320) ifTrue:[ |
|
2726 |
"/ 'colorMap (size=' print. valueArray size print. ')' printNewline. |
|
2727 |
||
2728 |
" |
|
2729 |
the tiff colormap contains 16bit values; |
|
2730 |
our colormap expects 8bit values |
|
2731 |
" |
|
2732 |
n := valueArray size // 3. |
|
2733 |
||
2734 |
rV := ByteArray uninitializedNew:n. |
|
2735 |
gV := ByteArray uninitializedNew:n. |
|
2736 |
bV := ByteArray uninitializedNew:n. |
|
2737 |
scaleFactor := 255.0 / 16rFFFF. |
|
2738 |
i2 := n+1. |
|
2739 |
i3 := 2*n+1. |
|
2740 |
1 to:n do:[:vi | |
|
2741 |
val := ((valueArray at:vi) * scaleFactor) rounded. |
|
2742 |
rV at:vi put:val. |
|
2743 |
val := ((valueArray at:i2) * scaleFactor) rounded. |
|
2744 |
gV at:vi put:val. |
|
2745 |
val := ((valueArray at:i3) * scaleFactor) rounded. |
|
2746 |
bV at:vi put:val. |
|
2747 |
i2 := i2 + 1. |
|
2748 |
i3 := i3 + 1. |
|
2749 |
]. |
|
2750 |
colorMap := MappedPalette redVector:rV greenVector:gV blueVector:bV. |
|
3984 | 2751 |
Verbose == true ifTrue:[ |
2752 |
Logger info:' colormap: ...' |
|
2753 |
]. |
|
3979 | 2754 |
^ self |
2755 |
]. |
|
2756 |
(tagType == 321) ifTrue:[ |
|
3984 | 2757 |
"/ halftonehints |
3979 | 2758 |
metaData at:#HalftoneHints put:value. |
2759 |
^ self |
|
2760 |
]. |
|
2761 |
(tagType == 322) ifTrue:[ |
|
3984 | 2762 |
"/ tilewidth |
2763 |
tileWidth := value. |
|
2764 |
Verbose == true ifTrue:[ |
|
2765 |
Logger info:' tileWidth: %1' with:value |
|
2766 |
]. |
|
2767 |
(tileWidth \\ 16) == 0 ifFalse:[ |
|
2768 |
Logger warning:'TIFFReader: tile width is not a multiple of 16'. |
|
2769 |
]. |
|
3979 | 2770 |
^ self |
2771 |
]. |
|
2772 |
(tagType == 323) ifTrue:[ |
|
3984 | 2773 |
"/ tilelength (height) |
2774 |
tileLength := value. |
|
2775 |
Verbose == true ifTrue:[ |
|
2776 |
Logger info:' tileLength: %1' with:value |
|
2777 |
]. |
|
2778 |
(tileLength \\ 16) == 0 ifFalse:[ |
|
2779 |
Logger warning:'TIFFReader: tile height is not a multiple of 16'. |
|
2780 |
]. |
|
3979 | 2781 |
^ self |
2782 |
]. |
|
2783 |
(tagType == 324) ifTrue:[ |
|
3984 | 2784 |
"/ tileoffsets |
2785 |
tileOffsets := valueArray. |
|
2786 |
Verbose == true ifTrue:[ |
|
2787 |
Logger info:' tileOffsets: %1' with:valueArray |
|
2788 |
]. |
|
3979 | 2789 |
^ self |
2790 |
]. |
|
2791 |
(tagType == 325) ifTrue:[ |
|
3984 | 2792 |
"/ tilebytecounts |
2793 |
tileByteCounts := valueArray. |
|
2794 |
Verbose == true ifTrue:[ |
|
2795 |
Logger info:' tileByteCounts: %1' with:valueArray |
|
2796 |
]. |
|
3979 | 2797 |
^ self |
2798 |
]. |
|
2799 |
(tagType == 326) ifTrue:[ |
|
3984 | 2800 |
"/ badFaxLines |
2801 |
Verbose == true ifTrue:[ |
|
2802 |
Logger info:' badFaxLines: %1' with:valueArray |
|
2803 |
]. |
|
3979 | 2804 |
^ self |
2805 |
]. |
|
2806 |
(tagType == 327) ifTrue:[ |
|
2807 |
"CleanFaxData" |
|
3984 | 2808 |
Verbose == true ifTrue:[ |
2809 |
"/ 'cleanfaxdata' print. value printNewline. |
|
2810 |
"/ (value == 0) ifTrue:[ |
|
2811 |
"/ 'no lines with incorrect pixel counts' printNewline |
|
2812 |
"/ ] ifFalse:[ |
|
2813 |
"/ (value == 1) ifTrue:[ |
|
2814 |
"/ 'incorrect lines were regenerated' printNewline |
|
2815 |
"/ ] ifFalse:[ |
|
2816 |
"/ (value == 2) ifTrue:[ |
|
2817 |
"/ 'incorrect lines were not regenerated' printNewline |
|
2818 |
"/ ] ifFalse:[ |
|
2819 |
"/ 'cleanfaxdata invalid' printNewline |
|
2820 |
"/ ] |
|
2821 |
"/ ] |
|
2822 |
"/ ]. |
|
2823 |
Logger info:' cleanfaxdata: %1' with:value |
|
2824 |
]. |
|
3979 | 2825 |
^ self |
2826 |
]. |
|
2827 |
(tagType == 328) ifTrue:[ |
|
3984 | 2828 |
"/ consecutiveBadFaxLines |
2829 |
Verbose == true ifTrue:[ |
|
2830 |
Logger info:' consecutiveBadFaxLines: %1' with:valueArray |
|
2831 |
]. |
|
3979 | 2832 |
^ self |
2833 |
]. |
|
2834 |
(tagType == 330) ifTrue:[ |
|
2835 |
"/ subifd |
|
2836 |
Verbose == true ifTrue:[ |
|
3984 | 2837 |
Logger info:' subifd: %1' with:valueArray |
3979 | 2838 |
]. |
3984 | 2839 |
subIfds := valueArray. |
3979 | 2840 |
^ self |
2841 |
]. |
|
2842 |
(tagType == 332) ifTrue:[ |
|
2843 |
"/ 'ink set' print. value printNewline. |
|
2844 |
^ self |
|
2845 |
]. |
|
2846 |
(tagType == 333) ifTrue:[ |
|
2847 |
"/ 'ink names' print. value printNewline. |
|
2848 |
metaData at:#IncNames put:value. |
|
2849 |
^ self |
|
2850 |
]. |
|
2851 |
(tagType == 334) ifTrue:[ |
|
2852 |
"/ 'numinks' print. value printNewline. |
|
2853 |
^ self |
|
2854 |
]. |
|
2855 |
(tagType == 336) ifTrue:[ |
|
2856 |
"/ 'dot range' print. value printNewline. |
|
2857 |
^ self |
|
2858 |
]. |
|
2859 |
(tagType == 337) ifTrue:[ |
|
2860 |
"/ 'target printer' print. value printNewline. |
|
2861 |
^ self |
|
2862 |
]. |
|
2863 |
(tagType == 338) ifTrue:[ |
|
2864 |
"/ 'extrasamples' print. value printNewline. |
|
3984 | 2865 |
Verbose == true ifTrue:[ |
2866 |
Logger info:' extrasamples: %1' with:value |
|
2867 |
]. |
|
3979 | 2868 |
^ self |
2869 |
]. |
|
2870 |
(tagType == 339) ifTrue:[ |
|
2871 |
"/ 'sample format' print. value printNewline. |
|
3984 | 2872 |
Verbose == true ifTrue:[ |
2873 |
Logger info:' sample format: %1 (=%2)' |
|
2874 |
with:value |
|
2875 |
with:(#( uint int float undef ) at:value ifAbsent:'???') |
|
2876 |
]. |
|
2877 |
sampleFormat := value. |
|
3979 | 2878 |
^ self |
2879 |
]. |
|
2880 |
(tagType == 340) ifTrue:[ |
|
2881 |
"/ 'min sample value' print. value printNewline. |
|
3984 | 2882 |
Verbose == true ifTrue:[ |
2883 |
Logger info:' min sample value: %1' with:value |
|
2884 |
]. |
|
2885 |
minSampleValue := value. |
|
3979 | 2886 |
^ self |
2887 |
]. |
|
2888 |
(tagType == 341) ifTrue:[ |
|
2889 |
"/ 'max sample value' print. value printNewline. |
|
3984 | 2890 |
Verbose == true ifTrue:[ |
2891 |
Logger info:' max sample value: %1' with:value |
|
2892 |
]. |
|
2893 |
maxSampleValue := value. |
|
3979 | 2894 |
^ self |
2895 |
]. |
|
2896 |
(tagType == 342) ifTrue:[ |
|
2897 |
"/ 'transfer range' print. value printNewline. |
|
2898 |
^ self |
|
2899 |
]. |
|
2900 |
(tagType == 343) ifTrue:[ |
|
2901 |
"/ 'clip path' print. value printNewline. |
|
2902 |
^ self |
|
2903 |
]. |
|
2904 |
(tagType == 344) ifTrue:[ |
|
2905 |
"/ 'xclip path units' print. value printNewline. |
|
2906 |
^ self |
|
2907 |
]. |
|
2908 |
(tagType == 345) ifTrue:[ |
|
2909 |
"/ 'yclip path units' print. value printNewline. |
|
2910 |
^ self |
|
2911 |
]. |
|
3984 | 2912 |
(tagType == 346) ifTrue:[ |
2913 |
"/ 'indexed' print. value printNewline. |
|
2914 |
^ self |
|
2915 |
]. |
|
3979 | 2916 |
(tagType == 347) ifTrue:[ |
2917 |
"/ 'jpegtables' print. value printNewline. |
|
2918 |
^ self |
|
2919 |
]. |
|
3984 | 2920 |
(tagType == 351) ifTrue:[ |
2921 |
"/ opiproxy |
|
2922 |
^ self |
|
2923 |
]. |
|
3979 | 2924 |
]. |
2925 |
||
2926 |
(tagType between:400 and:499) ifTrue:[ |
|
2927 |
(tagType == 400) ifTrue:[ |
|
2928 |
"/ 'GlobalParametersIFD' print. value printNewline. |
|
2929 |
^ self |
|
2930 |
]. |
|
2931 |
(tagType == 401) ifTrue:[ |
|
2932 |
"/ 'ProfileType' print. value printNewline. |
|
2933 |
^ self |
|
2934 |
]. |
|
2935 |
(tagType == 402) ifTrue:[ |
|
2936 |
"/ 'FaxProfile' print. value printNewline. |
|
2937 |
^ self |
|
2938 |
]. |
|
2939 |
(tagType == 403) ifTrue:[ |
|
2940 |
"/ 'CodingMethods' print. value printNewline. |
|
2941 |
^ self |
|
2942 |
]. |
|
2943 |
(tagType == 404) ifTrue:[ |
|
2944 |
"/ 'VersionYear' print. value printNewline. |
|
2945 |
^ self |
|
2946 |
]. |
|
2947 |
(tagType == 405) ifTrue:[ |
|
2948 |
"/ 'ModeNumber' print. value printNewline. |
|
2949 |
^ self |
|
2950 |
]. |
|
2951 |
(tagType == 433) ifTrue:[ |
|
2952 |
"/ 'Decode' print. value printNewline. |
|
2953 |
^ self |
|
2954 |
]. |
|
2955 |
(tagType == 434) ifTrue:[ |
|
2956 |
"/ 'DefaultImageColor' print. value printNewline. |
|
2957 |
^ self |
|
2958 |
]. |
|
2959 |
]. |
|
2960 |
||
2961 |
(tagType between:500 and:599) ifTrue:[ |
|
2962 |
"/ obsolete JPEG tags |
|
2963 |
(tagType == 512) ifTrue:[ |
|
2964 |
"/ 'jpeg proc' print. value printNewline. |
|
2965 |
^ self |
|
2966 |
]. |
|
2967 |
(tagType == 513) ifTrue:[ |
|
2968 |
"/ 'jpeg proc' print. value printNewline. |
|
2969 |
^ self |
|
2970 |
]. |
|
2971 |
(tagType == 514) ifTrue:[ |
|
2972 |
"/ 'jpeg ifByteCount' print. value printNewline. |
|
2973 |
^ self |
|
2974 |
]. |
|
2975 |
(tagType == 515) ifTrue:[ |
|
2976 |
"/ 'jpeg restartInterval' print. value printNewline. |
|
2977 |
^ self |
|
2978 |
]. |
|
2979 |
(tagType == 517) ifTrue:[ |
|
2980 |
"/ 'jpeg glossLessPredictors' print. value printNewline. |
|
2981 |
^ self |
|
2982 |
]. |
|
2983 |
(tagType == 518) ifTrue:[ |
|
2984 |
"/ 'jpeg pointTransform' print. value printNewline. |
|
2985 |
^ self |
|
2986 |
]. |
|
2987 |
(tagType == 519) ifTrue:[ |
|
2988 |
"/ 'jpeg qTables' print. value printNewline. |
|
2989 |
^ self |
|
2990 |
]. |
|
2991 |
(tagType == 520) ifTrue:[ |
|
2992 |
"/ 'jpeg dcTables' print. value printNewline. |
|
2993 |
^ self |
|
2994 |
]. |
|
2995 |
(tagType == 521) ifTrue:[ |
|
2996 |
"/ 'jpeg acTables' print. value printNewline. |
|
2997 |
^ self |
|
2998 |
]. |
|
2999 |
||
3000 |
||
3001 |
(tagType == 529) ifTrue:[ |
|
3002 |
"/ ycbr coeff |
|
3003 |
Verbose == true ifTrue:[ |
|
3004 |
Logger info:' ycbr coeff: %1' with:value |
|
3005 |
]. |
|
3006 |
^ self |
|
3007 |
]. |
|
3008 |
(tagType == 530) ifTrue:[ |
|
3009 |
"/ ycbr subsampling |
|
3010 |
Verbose == true ifTrue:[ |
|
3011 |
Logger info:' ycbr subsampling: %1' with:value |
|
3012 |
]. |
|
3013 |
^ self |
|
3014 |
]. |
|
3015 |
(tagType == 531) ifTrue:[ |
|
3016 |
"/ ycbr positioning |
|
3017 |
Verbose == true ifTrue:[ |
|
3018 |
Logger info:' ycbr positioning: %1' with:value |
|
3019 |
]. |
|
3020 |
^ self |
|
3021 |
]. |
|
3022 |
(tagType == 532) ifTrue:[ |
|
3023 |
"/ referenceBlackWhite |
|
3024 |
Verbose == true ifTrue:[ |
|
3025 |
Logger info:' referenceBlackWhite: %1' with:value |
|
3026 |
]. |
|
3027 |
^ self |
|
3028 |
]. |
|
3029 |
(tagType == 559) ifTrue:[ |
|
3984 | 3030 |
"/ stripRowCounts |
3031 |
"/ Defined in the Mixed Raster Content part of RFC 2301, |
|
3032 |
"/ used to replace RowsPerStrip for IFDs with variable-sized strips. |
|
3033 |
Verbose == true ifTrue:[ |
|
3034 |
Logger info:' stripRowCounts: %1' with:valueArray |
|
3035 |
]. |
|
3036 |
stripRowCounts := valueArray. |
|
3979 | 3037 |
^ self |
3038 |
]. |
|
3039 |
]. |
|
3040 |
||
3041 |
(tagType between:700 and:799) ifTrue:[ |
|
3042 |
(tagType == 700) ifTrue:[ |
|
3984 | 3043 |
"XMP metadata (xml)" |
3979 | 3044 |
|
3045 |
"/ In TIFF files, the XML Packet containing XMP metadata is pointed to |
|
3046 |
"/ by an entry in the Image File Directory (IFD). That entry has a Tag |
|
3047 |
"/ value of 700, as shown in Table 1.1, "TIFF IFD Directory Entry for |
|
3048 |
"/ XML Packets |
|
3049 |
||
3050 |
Verbose == true ifTrue:[ |
|
3051 |
Logger info:' XMLPACKET: %1' with:value asString |
|
3052 |
]. |
|
3985 | 3053 |
decodeMetaTags == true ifTrue:[ |
3054 |
metaData at:#xmpData put:value asString. |
|
3055 |
]. |
|
3979 | 3056 |
^ self |
3057 |
]. |
|
3058 |
]. |
|
3059 |
||
3984 | 3060 |
(tagType between:18000 and:18999) ifTrue:[ |
3061 |
(tagType == 18246) ifTrue:[ |
|
3062 |
"/ Image Rating by windows |
|
3063 |
^ self |
|
3064 |
]. |
|
3065 |
(tagType == 18249) ifTrue:[ |
|
3066 |
"/ Image Rating Percent by windows |
|
3067 |
^ self |
|
3068 |
]. |
|
3069 |
]. |
|
3070 |
||
3979 | 3071 |
(tagType between:32000 and:32999) ifTrue:[ |
3072 |
(tagType == 32781) ifTrue:[ |
|
3073 |
"/'imageid' print. value printNewline. |
|
3074 |
^ self |
|
3075 |
]. |
|
3076 |
(tagType == 32932) ifTrue:[ |
|
3077 |
"/'wang annotation' print. value printNewline. |
|
3078 |
^ self |
|
3079 |
]. |
|
3080 |
||
3081 |
"/ Private Island graphics tags |
|
3082 |
(tagType == 32953) ifTrue:[ |
|
3083 |
"/'ref points' print. value printNewline. |
|
3084 |
^ self |
|
3085 |
]. |
|
3086 |
(tagType == 32954) ifTrue:[ |
|
3087 |
"/ 'regionTagPoint' print. value printNewline. |
|
3088 |
^ self |
|
3089 |
]. |
|
3090 |
(tagType == 32955) ifTrue:[ |
|
3091 |
"/ 'regionWarpCorners' print. value printNewline. |
|
3092 |
^ self |
|
3093 |
]. |
|
3094 |
(tagType == 32956) ifTrue:[ |
|
3095 |
"/ 'regionAffine' print. value printNewline. |
|
3096 |
^ self |
|
3097 |
]. |
|
3098 |
||
3099 |
||
3100 |
"/ Private SGI tags |
|
3101 |
(tagType == 32995) ifTrue:[ |
|
3102 |
"/ 'matteing' print. value printNewline. |
|
3103 |
^ self |
|
3104 |
]. |
|
3984 | 3105 |
|
3979 | 3106 |
(tagType == 32996) ifTrue:[ |
3984 | 3107 |
"/ datatype |
3108 |
Verbose == true ifTrue:[ |
|
3109 |
Logger info:' datatype: %1' with:value |
|
3110 |
]. |
|
3979 | 3111 |
^ self |
3112 |
]. |
|
3113 |
(tagType == 32997) ifTrue:[ |
|
3984 | 3114 |
"/ imagedepth |
3115 |
Verbose == true ifTrue:[ |
|
3116 |
Logger info:' imagedepth: %1' with:value |
|
3117 |
]. |
|
3979 | 3118 |
^ self |
3119 |
]. |
|
3120 |
(tagType == 32998) ifTrue:[ |
|
3984 | 3121 |
"/ tiledepth |
3122 |
Verbose == true ifTrue:[ |
|
3123 |
Logger info:' tiledepth: %1' with:value |
|
3124 |
]. |
|
3979 | 3125 |
^ self |
3126 |
]. |
|
3127 |
]. |
|
3128 |
||
3129 |
(tagType between:33000 and:33999) ifTrue:[ |
|
3130 |
"/ Private Pixar tags |
|
3131 |
(tagType == 33300) ifTrue:[ |
|
3132 |
"/ 'image full width' print. value printNewline. |
|
3133 |
^ self |
|
3134 |
]. |
|
3135 |
(tagType == 33301) ifTrue:[ |
|
3136 |
"/ 'image full length' print. value printNewline. |
|
3137 |
^ self |
|
3138 |
]. |
|
3139 |
||
3140 |
"/ Private Eastman Kodak tags |
|
3141 |
(tagType == 33405) ifTrue:[ |
|
3142 |
"/ 'write serial number' print. value printNewline. |
|
3143 |
^ self |
|
3144 |
]. |
|
3145 |
||
3984 | 3146 |
(tagType == 33421) ifTrue:[ |
3147 |
"/ CFARepeatPatternDim - For camera raw files from sensors with CFA overlay |
|
3148 |
Verbose == true ifTrue:[ |
|
3149 |
Logger info:' CFARepeatPatternDim: %1' with:value |
|
3150 |
]. |
|
3151 |
^ self |
|
3152 |
]. |
|
3153 |
(tagType == 33422) ifTrue:[ |
|
3154 |
"/ CFAPattern - For camera raw files from sensors with CFA overlay |
|
3155 |
Verbose == true ifTrue:[ |
|
3156 |
Logger info:' CFAPattern: %1' with:value |
|
3157 |
]. |
|
3158 |
^ self |
|
3159 |
]. |
|
3160 |
(tagType == 33423) ifTrue:[ |
|
3161 |
"/ BatteryLevel - Encodes camera battery level at time of image capture |
|
3162 |
^ self |
|
3163 |
]. |
|
3979 | 3164 |
(tagType == 33432) ifTrue:[ |
3165 |
"/ 'copyright' print. value printNewline. |
|
3166 |
^ self |
|
3167 |
]. |
|
3168 |
||
3169 |
(tagType == 33550) ifTrue:[ |
|
3170 |
"/ 'geotiff modelpixelscaletag' print. value printNewline. |
|
3171 |
^ self |
|
3172 |
]. |
|
3173 |
||
3174 |
(tagType == 33723) ifTrue:[ |
|
3175 |
"/ 'RICHTIFFIPTC' print. value printNewline. |
|
3176 |
^ self |
|
3177 |
]. |
|
3984 | 3178 |
|
3179 |
||
3180 |
(tagType == 33920) ifTrue:[ |
|
3181 |
"/ 'geotiff IntergraphMatrixTag' print. value printNewline. |
|
3182 |
^ self |
|
3183 |
]. |
|
3184 |
(tagType == 33922) ifTrue:[ |
|
3185 |
"/ 'geotiff ModelTiepointTag' print. value printNewline. |
|
3186 |
^ self |
|
3187 |
]. |
|
3188 |
||
3979 | 3189 |
]. |
3984 | 3190 |
|
3979 | 3191 |
(tagType between:34000 and:34999) ifTrue:[ |
3984 | 3192 |
(tagType == 34016) ifTrue:[ |
3193 |
"/ Site |
|
3194 |
Verbose == true ifTrue:[ |
|
3195 |
Logger info:' site: %1' with:value |
|
3196 |
]. |
|
3197 |
^ self |
|
3198 |
]. |
|
3199 |
(tagType == 34017) ifTrue:[ |
|
3200 |
"/ colorSequence |
|
3201 |
^ self |
|
3202 |
]. |
|
3203 |
(tagType == 34018) ifTrue:[ |
|
3204 |
"/ it8header |
|
3205 |
^ self |
|
3206 |
]. |
|
3207 |
(tagType == 34019) ifTrue:[ |
|
3208 |
"/ rasterPadding |
|
3209 |
^ self |
|
3210 |
]. |
|
3211 |
(tagType == 34020) ifTrue:[ |
|
3212 |
"/ bitsPerRunLength |
|
3213 |
^ self |
|
3214 |
]. |
|
3215 |
(tagType == 34021) ifTrue:[ |
|
3216 |
"/ bitsPerExtendedRunLength |
|
3217 |
^ self |
|
3218 |
]. |
|
3219 |
(tagType == 34022) ifTrue:[ |
|
3220 |
"/ colorTable |
|
3221 |
^ self |
|
3222 |
]. |
|
3223 |
(tagType == 34023) ifTrue:[ |
|
3224 |
"/ imageColorIndicator |
|
3225 |
^ self |
|
3226 |
]. |
|
3227 |
(tagType == 34024) ifTrue:[ |
|
3228 |
"/ backgroundColorIndicator |
|
3229 |
^ self |
|
3230 |
]. |
|
3231 |
(tagType == 34025) ifTrue:[ |
|
3232 |
"/ imageColorValue |
|
3233 |
^ self |
|
3234 |
]. |
|
3235 |
(tagType == 34026) ifTrue:[ |
|
3236 |
"/ backgroundColorValue |
|
3237 |
^ self |
|
3238 |
]. |
|
3239 |
(tagType == 34027) ifTrue:[ |
|
3240 |
"/ pixelIntensityRange |
|
3241 |
^ self |
|
3242 |
]. |
|
3243 |
(tagType == 34028) ifTrue:[ |
|
3244 |
"/ transparencyIndicator |
|
3245 |
^ self |
|
3246 |
]. |
|
3247 |
(tagType == 34029) ifTrue:[ |
|
3248 |
"/ colorCharacterization |
|
3249 |
^ self |
|
3250 |
]. |
|
3251 |
(tagType == 34030) ifTrue:[ |
|
3252 |
"/ hcUsage |
|
3253 |
^ self |
|
3254 |
]. |
|
3255 |
(tagType == 34031) ifTrue:[ |
|
3256 |
"/ trapIndicator |
|
3257 |
^ self |
|
3258 |
]. |
|
3259 |
(tagType == 34032) ifTrue:[ |
|
3260 |
"/ cmykEquivalent |
|
3979 | 3261 |
^ self |
3262 |
]. |
|
3263 |
||
3264 |
"/ Private Pixel magic |
|
3265 |
(tagType == 34232) ifTrue:[ |
|
3266 |
"/ 'jbig options' print. value printNewline. |
|
3267 |
^ self |
|
3268 |
]. |
|
3269 |
||
3984 | 3270 |
(tagType == 34264) ifTrue:[ |
3271 |
"/ 'geotiff ModelTransformationTag' print. value printNewline. |
|
3272 |
^ self |
|
3273 |
]. |
|
3979 | 3274 |
"/ private Photoshop |
3275 |
(tagType == 34377) ifTrue:[ |
|
3984 | 3276 |
"/ RICHTIFFIPTC |
3277 |
"/ IPTC (International Press Telecommunications Council) metadata. |
|
3278 |
"/ (see http://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata) |
|
3279 |
decodeMetaTags == true ifTrue:[ |
|
3985 | 3280 |
Verbose == true ifTrue:[ |
3281 |
Logger info:' RICHTIFFIPTC: %1' with:value |
|
3282 |
]. |
|
3984 | 3283 |
self decodePhotoshopImageResourceBlock:value. |
3284 |
] ifFalse:[ |
|
3285 |
Verbose == true ifTrue:[ |
|
3286 |
Logger info:' skipped decoding of IPTC-PhotoMetadata' |
|
3287 |
]. |
|
3288 |
]. |
|
3979 | 3289 |
^ self |
3290 |
]. |
|
3984 | 3291 |
|
3979 | 3292 |
(tagType == 34665) ifTrue:[ |
3293 |
"/ EXIFIFD |
|
3294 |
Verbose == true ifTrue:[ |
|
3295 |
Logger info:' EXIFIFD: %1' with:value |
|
3296 |
]. |
|
3297 |
^ self |
|
3298 |
]. |
|
3299 |
(tagType == 34675) ifTrue:[ |
|
3300 |
"/ 'ICCPROFILE' print. value printNewline. |
|
3301 |
^ self |
|
3302 |
]. |
|
3303 |
||
3304 |
(tagType == 34732) ifTrue:[ |
|
3305 |
"/ 'ImageLayer' print. value printNewline. |
|
3306 |
^ self |
|
3307 |
]. |
|
3984 | 3308 |
|
3309 |
(tagType == 34735) ifTrue:[ |
|
3310 |
"/ 'geotiff GeoKeyDirectoryTag' print. value printNewline. |
|
3311 |
^ self |
|
3312 |
]. |
|
3313 |
(tagType == 34736) ifTrue:[ |
|
3314 |
"/ 'geotiff GeoDoubleParamsTag' print. value printNewline. |
|
3315 |
^ self |
|
3316 |
]. |
|
3317 |
(tagType == 34737) ifTrue:[ |
|
3318 |
"/ 'geotiff GeoAsciiParamsTag' print. value printNewline. |
|
3319 |
^ self |
|
3320 |
]. |
|
3321 |
||
3322 |
||
3979 | 3323 |
(tagType == 34859) ifTrue:[ |
3324 |
"/ '???' print. value printNewline. |
|
3984 | 3325 |
"/ Verbose == true ifTrue:[ |
3326 |
"/ Logger info:' ?: %1' with:value |
|
3327 |
"/ ]. |
|
3979 | 3328 |
^ self |
3329 |
]. |
|
3330 |
||
3331 |
"/ More Private SGI |
|
3332 |
(tagType == 34908) ifTrue:[ |
|
3333 |
"/ 'fax recv params' print. value printNewline. |
|
3334 |
^ self |
|
3335 |
]. |
|
3336 |
(tagType == 34909) ifTrue:[ |
|
3337 |
"/ 'fax subaddress' print. value printNewline. |
|
3338 |
^ self |
|
3339 |
]. |
|
3340 |
(tagType == 34910) ifTrue:[ |
|
3341 |
"/ 'fax recv time' print. value printNewline. |
|
3342 |
^ self |
|
3343 |
]. |
|
3344 |
]. |
|
3345 |
||
3346 |
(tagType between:36000 and:36999) ifTrue:[ |
|
3347 |
(tagType == 36867) ifTrue:[ |
|
3348 |
"/ '???' print. value printNewline. |
|
3349 |
^ self |
|
3350 |
]. |
|
3351 |
]. |
|
3352 |
||
3353 |
(tagType between:37000 and:37999) ifTrue:[ |
|
3354 |
(tagType == 37390) ifTrue:[ |
|
3355 |
"/ '???' print. value printNewline. |
|
3356 |
^ self |
|
3357 |
]. |
|
3358 |
(tagType == 37391) ifTrue:[ |
|
3359 |
"/ '???' print. value printNewline. |
|
3360 |
^ self |
|
3361 |
]. |
|
3362 |
(tagType == 37392) ifTrue:[ |
|
3363 |
"/ '???' print. value printNewline. |
|
3364 |
^ self |
|
3365 |
]. |
|
3366 |
(tagType == 37398) ifTrue:[ |
|
3367 |
"/ '???' print. value printNewline. |
|
3368 |
^ self |
|
3369 |
]. |
|
3370 |
]. |
|
3371 |
||
3372 |
(tagType between:42000 and:42999) ifTrue:[ |
|
3373 |
(tagType == 42112) ifTrue:[ |
|
3374 |
"/ 'GDAL_METADATA' print. value printNewline. |
|
3984 | 3375 |
Verbose == true ifTrue:[ |
3376 |
Logger info:' GDAL_METADATA: %1' with:value |
|
3377 |
]. |
|
3979 | 3378 |
^ self |
3379 |
]. |
|
3380 |
]. |
|
3381 |
||
3382 |
"/ dng tags (see http://wwwimages.adobe.com/content/dam/Adobe/en/products/photoshop/pdfs/dng_spec_1.4.0.0.pdf) |
|
3383 |
(tagType between:50000 and:50999) ifTrue:[ |
|
3384 |
(tagType == 50706) ifTrue:[ |
|
3385 |
"/ DNGVersion |
|
3386 |
Verbose == true ifTrue:[ |
|
3387 |
Logger info:' DNGVersion: %1' with:value |
|
3388 |
]. |
|
3984 | 3389 |
isDNGImage := true. |
3979 | 3390 |
^ self |
3391 |
]. |
|
3392 |
(tagType == 50707) ifTrue:[ |
|
3393 |
"/ DNGBackwardVersion |
|
3394 |
^ self |
|
3395 |
]. |
|
3396 |
(tagType == 50708) ifTrue:[ |
|
3397 |
"/ UniqueCameraModel |
|
3398 |
Verbose == true ifTrue:[ |
|
3984 | 3399 |
Logger info:' UniqueCameraModel: %1' with:value |
3979 | 3400 |
]. |
3401 |
^ self |
|
3402 |
]. |
|
3403 |
(tagType == 50709) ifTrue:[ |
|
3404 |
"/ LocalizedCameraModel |
|
3405 |
Verbose == true ifTrue:[ |
|
3984 | 3406 |
Logger info:' LocalizedCameraModel: %1' with:value |
3979 | 3407 |
]. |
3408 |
^ self |
|
3409 |
]. |
|
3410 |
(tagType == 50710) ifTrue:[ |
|
3411 |
"/ 'CFAPlaneColor' print. value printNewline. |
|
3412 |
^ self |
|
3413 |
]. |
|
3414 |
(tagType == 50711) ifTrue:[ |
|
3415 |
"/ 'CFALayout' print. value printNewline. |
|
3416 |
^ self |
|
3417 |
]. |
|
3418 |
(tagType == 50712) ifTrue:[ |
|
3419 |
"/ 'LinearizationTable' print. value printNewline. |
|
3420 |
^ self |
|
3421 |
]. |
|
3422 |
(tagType == 50713) ifTrue:[ |
|
3423 |
"/ 'BlackLevelRepeatDim' print. value printNewline. |
|
3424 |
^ self |
|
3425 |
]. |
|
3426 |
(tagType == 50714) ifTrue:[ |
|
3427 |
"/ 'BlackLevel' print. value printNewline. |
|
3428 |
^ self |
|
3429 |
]. |
|
3430 |
(tagType == 50715) ifTrue:[ |
|
3431 |
"/ 'BlackLevelDeltaH' print. value printNewline. |
|
3432 |
^ self |
|
3433 |
]. |
|
3434 |
(tagType == 50716) ifTrue:[ |
|
3435 |
"/ 'BlackLevelDeltaV' print. value printNewline. |
|
3436 |
^ self |
|
3437 |
]. |
|
3438 |
(tagType == 50717) ifTrue:[ |
|
3439 |
"/ 'WhiteLevel' print. value printNewline. |
|
3440 |
^ self |
|
3441 |
]. |
|
3442 |
(tagType == 50718) ifTrue:[ |
|
3443 |
"/ 'DefaultScale' print. value printNewline. |
|
3444 |
^ self |
|
3445 |
]. |
|
3446 |
(tagType == 50719) ifTrue:[ |
|
3447 |
"/ 'DefaultCropOrigin' print. value printNewline. |
|
3448 |
^ self |
|
3449 |
]. |
|
3450 |
(tagType == 50720) ifTrue:[ |
|
3451 |
"/ 'DefaultCropSize' print. value printNewline. |
|
3452 |
^ self |
|
3453 |
]. |
|
3454 |
(tagType == 50721) ifTrue:[ |
|
3455 |
"/ 'ColorMatrix1' print. value printNewline. |
|
3456 |
^ self |
|
3457 |
]. |
|
3458 |
(tagType == 50722) ifTrue:[ |
|
3459 |
"/ 'ColorMatrix2' print. value printNewline. |
|
3460 |
^ self |
|
3461 |
]. |
|
3462 |
(tagType == 50723) ifTrue:[ |
|
3463 |
"/ 'CameraCalibrarion1' print. value printNewline. |
|
3464 |
^ self |
|
3465 |
]. |
|
3466 |
(tagType == 50724) ifTrue:[ |
|
3467 |
"/ 'CameraCalibrarion2' print. value printNewline. |
|
3468 |
^ self |
|
3469 |
]. |
|
3470 |
(tagType == 50725) ifTrue:[ |
|
3471 |
"/ 'ReductionMatrix1' print. value printNewline. |
|
3472 |
^ self |
|
3473 |
]. |
|
3474 |
(tagType == 50726) ifTrue:[ |
|
3475 |
"/ 'ReductionMatrix2' print. value printNewline. |
|
3476 |
^ self |
|
3477 |
]. |
|
3478 |
(tagType == 50727) ifTrue:[ |
|
3479 |
"/ 'AnalogBalance' print. value printNewline. |
|
3480 |
^ self |
|
3481 |
]. |
|
3482 |
(tagType == 50728) ifTrue:[ |
|
3483 |
"/ 'AsShotNeutral' print. value printNewline. |
|
3484 |
^ self |
|
3485 |
]. |
|
3486 |
(tagType == 50729) ifTrue:[ |
|
3487 |
"/ 'AsShotWhiteXY' print. value printNewline. |
|
3488 |
^ self |
|
3489 |
]. |
|
3490 |
(tagType == 50730) ifTrue:[ |
|
3491 |
"/ 'BaselineExposure' print. value printNewline. |
|
3492 |
^ self |
|
3493 |
]. |
|
3494 |
(tagType == 50731) ifTrue:[ |
|
3495 |
"/ 'BaselineNoise' print. value printNewline. |
|
3496 |
^ self |
|
3497 |
]. |
|
3498 |
(tagType == 50732) ifTrue:[ |
|
3499 |
"/ 'BaselineSharpness' print. value printNewline. |
|
3500 |
^ self |
|
3501 |
]. |
|
3502 |
(tagType == 50733) ifTrue:[ |
|
3503 |
"/ 'ByerGreenSplit' print. value printNewline. |
|
3504 |
^ self |
|
3505 |
]. |
|
3506 |
(tagType == 50734) ifTrue:[ |
|
3507 |
"/ 'LinearResponseLimit' print. value printNewline. |
|
3508 |
^ self |
|
3509 |
]. |
|
3510 |
(tagType == 50735) ifTrue:[ |
|
3511 |
"/ 'CameraSerialNumber' print. value printNewline. |
|
3512 |
Verbose == true ifTrue:[ |
|
3984 | 3513 |
Logger info:' CameraSerialNumber: %1' with:value |
3979 | 3514 |
]. |
3515 |
^ self |
|
3516 |
]. |
|
3517 |
(tagType == 50736) ifTrue:[ |
|
3518 |
"/ 'LensInfo' print. value printNewline. |
|
3519 |
^ self |
|
3520 |
]. |
|
3521 |
(tagType == 50737) ifTrue:[ |
|
3522 |
"/ 'ChromaBlurRadius' print. value printNewline. |
|
3523 |
^ self |
|
3524 |
]. |
|
3525 |
(tagType == 50738) ifTrue:[ |
|
3526 |
"/ 'AntiAliasStrength' print. value printNewline. |
|
3527 |
^ self |
|
3528 |
]. |
|
3529 |
(tagType == 50739) ifTrue:[ |
|
3530 |
"/ 'ShadowScale' print. value printNewline. |
|
3531 |
^ self |
|
3532 |
]. |
|
3533 |
(tagType == 50740) ifTrue:[ |
|
3534 |
"/ 'DNGPrivateData' print. value printNewline. |
|
3535 |
^ self |
|
3536 |
]. |
|
3537 |
(tagType == 50741) ifTrue:[ |
|
3538 |
"/ 'MakerNoteSafety' print. value printNewline. |
|
3539 |
^ self |
|
3540 |
]. |
|
3984 | 3541 |
|
3979 | 3542 |
(tagType == 50778) ifTrue:[ |
3543 |
"/ 'CalibrationIlluminant1' print. value printNewline. |
|
3544 |
^ self |
|
3545 |
]. |
|
3546 |
(tagType == 50779) ifTrue:[ |
|
3547 |
"/ 'CalibrationIlluminant2' print. value printNewline. |
|
3548 |
^ self |
|
3549 |
]. |
|
3550 |
(tagType == 50780) ifTrue:[ |
|
3551 |
"/ 'BestQualityScale' print. value printNewline. |
|
3552 |
^ self |
|
3553 |
]. |
|
3554 |
(tagType == 50781) ifTrue:[ |
|
3555 |
"/ 'RawDataUniqueID' print. value printNewline. |
|
3556 |
^ self |
|
3557 |
]. |
|
3984 | 3558 |
|
3979 | 3559 |
(tagType == 50827) ifTrue:[ |
3560 |
"/ 'OriginalRawFileName' print. value printNewline. |
|
3561 |
^ self |
|
3562 |
]. |
|
3563 |
]. |
|
3564 |
||
3565 |
"/ |
|
3566 |
"/ 'TIFFReader: tag:' print. tagType print. ' typ:' print. numberType print. |
|
3567 |
"/ ' len:' print. length print. ' offs:' print. offset print. |
|
3568 |
"/ ' val:' print. value print. ' valArr:' print. valueArray printNewline. |
|
3569 |
"/ |
|
3570 |
'TIFFReader [warning]: unknown tag type ' errorPrint. tagType errorPrintCR |
|
3571 |
||
3572 |
"Modified (format): / 23-05-2017 / 16:12:58 / mawalch" |
|
3986 | 3573 |
"Modified: / 28-08-2017 / 00:48:37 / cg" |
3979 | 3574 |
! |
3575 |
||
1702
75a595a70c86
stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents:
1571
diff
changeset
|
3576 |
positionToStrip:stripNr |
3211 | 3577 |
inStream position:(stripOffsets at:stripNr). |
1702
75a595a70c86
stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents:
1571
diff
changeset
|
3578 |
! |
75a595a70c86
stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents:
1571
diff
changeset
|
3579 |
|
3979 | 3580 |
positionToTile:tileNr |
3581 |
inStream position:((metaData at:#'TileOffsets') at:tileNr). |
|
3582 |
||
3583 |
"Created: / 25-08-2017 / 13:43:30 / cg" |
|
3584 |
! |
|
3585 |
||
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3586 |
readBytes:n signed:isSigned |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3587 |
"read n 8bit signed or unsigned integers and return them in an array or byteArray" |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3588 |
|
3975 | 3589 |
|oldPos offset bytes nInline| |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3590 |
|
3975 | 3591 |
nInline := isBigTiff ifTrue:[8] ifFalse:[4]. |
3984 | 3592 |
|
3593 |
n == 0 ifTrue:[ |
|
3594 |
"/ even in this case, one WORD is to be skipped. |
|
3595 |
inStream skip:nInline. |
|
3596 |
^ '' |
|
3597 |
]. |
|
3598 |
||
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3599 |
bytes := (isSigned ifTrue:[Array] ifFalse:[ByteArray]) new:n. |
3975 | 3600 |
(n <= nInline) ifTrue:[ |
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3601 |
isSigned ifTrue:[ |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3602 |
1 to:n do:[:i | bytes at:i put:(inStream nextSignedByte) ]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3603 |
] ifFalse:[ |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3604 |
inStream nextBytes:n into:bytes. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3605 |
]. |
3975 | 3606 |
(n < nInline) ifTrue:[ |
3607 |
inStream skip:(nInline - n). |
|
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3608 |
] |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3609 |
] ifFalse:[ |
3552 | 3610 |
offset := inStream nextInt32MSB:(byteOrder ~~ #lsb). |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3611 |
oldPos := inStream position. |
3211 | 3612 |
inStream position:offset. |
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3613 |
isSigned ifTrue:[ |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3614 |
1 to:n do:[:i | bytes at:i put:(inStream nextSignedByte) ]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3615 |
] ifFalse:[ |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3616 |
inStream nextBytes:n into:bytes. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3617 |
]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3618 |
inStream position:oldPos |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3619 |
]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3620 |
^ bytes |
3975 | 3621 |
|
3984 | 3622 |
"Modified: / 27-08-2017 / 19:56:23 / cg" |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3623 |
! |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3624 |
|
516 | 3625 |
readChars:n |
3626 |
"read n characters and return them in a string" |
|
3627 |
||
3975 | 3628 |
|oldPos offset string nInline| |
516 | 3629 |
|
3975 | 3630 |
nInline := isBigTiff ifTrue:[8] ifFalse:[4]. |
3984 | 3631 |
|
3632 |
n == 0 ifTrue:[ |
|
3633 |
"/ even in this case, one WORD is to be skipped. |
|
3634 |
inStream skip:nInline. |
|
3635 |
^ '' |
|
3636 |
]. |
|
3637 |
||
516 | 3638 |
string := String new:(n - 1). |
3975 | 3639 |
(n <= nInline) ifTrue:[ |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3640 |
inStream nextBytes:(n - 1) into:string. |
3984 | 3641 |
inStream next. "/ skip the 0-byte. |
3642 |
||
3975 | 3643 |
(n < nInline) ifTrue:[ |
3644 |
inStream skip:(nInline - n). |
|
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3645 |
] |
516 | 3646 |
] ifFalse:[ |
3984 | 3647 |
offset := inStream nextInt32MSB:(byteOrder == #msb). |
516 | 3648 |
oldPos := inStream position. |
3211 | 3649 |
inStream position:offset. |
516 | 3650 |
inStream nextBytes:(n - 1) into:string. |
3651 |
inStream position:oldPos |
|
3652 |
]. |
|
3653 |
^ string |
|
3654 |
||
3984 | 3655 |
"Modified: / 27-08-2017 / 19:55:15 / cg" |
516 | 3656 |
! |
3657 |
||
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3658 |
readDoubles:nFloats |
3112 | 3659 |
"read nFloats IEEE 64bit doubles and return them in an array" |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3660 |
|
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3661 |
|oldPos offset values val msb |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3662 |
n "{ Class: SmallInteger }" | |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3663 |
|
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3664 |
n := nFloats. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3665 |
|
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3666 |
msb := byteOrder ~~ #lsb. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3667 |
values := DoubleArray basicNew:n. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3668 |
(n == 1) ifTrue:[ |
3112 | 3669 |
val := Float readBinaryIEEEDoubleFrom:inStream MSB:msb. |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3670 |
values at:1 put:val. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3671 |
] ifFalse:[ |
3552 | 3672 |
offset := inStream nextInt32MSB:msb. |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3673 |
oldPos := inStream position. |
3211 | 3674 |
inStream position:offset. |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3675 |
1 to:n do:[:index | |
3112 | 3676 |
val := Float readBinaryIEEEDoubleFrom:inStream MSB:msb. |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3677 |
values at:index put:val |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3678 |
]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3679 |
inStream position:oldPos |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3680 |
]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3681 |
^ values |
3975 | 3682 |
|
3683 |
"Modified: / 24-08-2017 / 23:28:22 / cg" |
|
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3684 |
! |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3685 |
|
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3686 |
readFloats:nFloats |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3687 |
"read nFloats IEEE 32bit floats and return them in an array" |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3688 |
|
3975 | 3689 |
|oldPos offset values val val1 val2 msb |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3690 |
n "{ Class: SmallInteger }" | |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3691 |
|
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3692 |
n := nFloats. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3693 |
|
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3694 |
msb := byteOrder ~~ #lsb. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3695 |
values := FloatArray basicNew:n. |
3975 | 3696 |
(isBigTiff and:[ n == 2 ]) ifTrue:[ |
3697 |
val1 := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb. |
|
3698 |
val2 := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb. |
|
3699 |
values at:1 put:val1. |
|
3700 |
n == 2 ifTrue:[ |
|
3701 |
values at:2 put:val2. |
|
3702 |
]. |
|
3703 |
] ifFalse:[ |
|
3704 |
(n == 1) ifTrue:[ |
|
3112 | 3705 |
val := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb. |
3975 | 3706 |
values at:1 put:val. |
3707 |
] ifFalse:[ |
|
3708 |
offset := inStream nextInt32MSB:msb. |
|
3709 |
oldPos := inStream position. |
|
3710 |
inStream position:offset. |
|
3711 |
1 to:n do:[:index | |
|
3712 |
val := ShortFloat readBinaryIEEESingleFrom:inStream MSB:msb. |
|
3713 |
values at:index put:val |
|
3714 |
]. |
|
3715 |
inStream position:oldPos |
|
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3716 |
]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3717 |
]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3718 |
^ values |
3975 | 3719 |
|
3720 |
"Modified: / 24-08-2017 / 23:36:39 / cg" |
|
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3721 |
! |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3722 |
|
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3723 |
readFracts:nFracts signed:isSigned |
516 | 3724 |
"read nFracts fractions (2 32bit words) and return them in an array" |
3725 |
||
3726 |
|oldPos offset values numerator denominator msb |
|
3727 |
n "{ Class: SmallInteger }" | |
|
3728 |
||
3729 |
n := nFracts. |
|
3730 |
||
3731 |
msb := byteOrder ~~ #lsb. |
|
3732 |
values := Array basicNew:n. |
|
3552 | 3733 |
offset := inStream nextInt32MSB:msb. |
516 | 3734 |
oldPos := inStream position. |
3211 | 3735 |
inStream position:offset. |
516 | 3736 |
1 to:n do:[:index | |
3552 | 3737 |
numerator := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb]. |
3738 |
denominator := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb]. |
|
1702
75a595a70c86
stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents:
1571
diff
changeset
|
3739 |
values at:index put:(Fraction numerator:numerator denominator:denominator) |
516 | 3740 |
]. |
3741 |
inStream position:oldPos. |
|
3742 |
^ values |
|
3743 |
! |
|
3744 |
||
3974 | 3745 |
readLong8s:nLongs signed:isSigned |
3746 |
"read nLongs signed or unsigned long8 numbers (64bit) and return them in an array" |
|
3747 |
||
3748 |
|oldPos offset values val msb |
|
3749 |
n "{ Class: SmallInteger }" | |
|
3750 |
||
3751 |
n := nLongs. |
|
3752 |
||
3753 |
msb := byteOrder ~~ #lsb. |
|
3754 |
values := Array basicNew:n. |
|
3755 |
(n == 1) ifTrue:[ |
|
3756 |
val := isSigned ifTrue:[inStream nextInt64MSB:msb] ifFalse:[inStream nextUnsignedInt64MSB:msb]. |
|
3757 |
values at:1 put:val. |
|
3758 |
] ifFalse:[ |
|
3759 |
offset := inStream nextInt64MSB:msb. |
|
3760 |
oldPos := inStream position. |
|
3761 |
inStream position:offset. |
|
3762 |
1 to:n do:[:index | |
|
3763 |
val := isSigned ifTrue:[inStream nextInt64MSB:msb] ifFalse:[inStream nextUnsignedInt64MSB:msb]. |
|
3764 |
values at:index put:val |
|
3765 |
]. |
|
3766 |
inStream position:oldPos |
|
3767 |
]. |
|
3768 |
^ values |
|
3769 |
||
3770 |
"Created: / 24-08-2017 / 22:01:26 / cg" |
|
3771 |
! |
|
3772 |
||
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3773 |
readLongs:nLongs signed:isSigned |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3774 |
"read nLongs signed or unsigned long numbers (32bit) and return them in an array" |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3775 |
|
3975 | 3776 |
|oldPos offset values val val1 val2 msb |
516 | 3777 |
n "{ Class: SmallInteger }" | |
3778 |
||
3779 |
n := nLongs. |
|
3780 |
||
3781 |
msb := byteOrder ~~ #lsb. |
|
3782 |
values := Array basicNew:n. |
|
3975 | 3783 |
(isBigTiff and:[ n <= 2 ]) ifTrue:[ |
3784 |
val1 := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb]. |
|
3785 |
val2 := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb]. |
|
3786 |
values at:1 put:val1. |
|
3787 |
n == 2 ifTrue:[ |
|
3788 |
values at:2 put:val2. |
|
3789 |
]. |
|
516 | 3790 |
] ifFalse:[ |
3975 | 3791 |
(n == 1) ifTrue:[ |
3552 | 3792 |
val := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb]. |
3975 | 3793 |
values at:1 put:val. |
3794 |
] ifFalse:[ |
|
3795 |
offset := inStream nextInt32MSB:msb. |
|
3796 |
oldPos := inStream position. |
|
3797 |
inStream position:offset. |
|
3798 |
1 to:n do:[:index | |
|
3799 |
val := isSigned ifTrue:[inStream nextInt32MSB:msb] ifFalse:[inStream nextUnsignedInt32MSB:msb]. |
|
3800 |
values at:index put:val |
|
3801 |
]. |
|
3802 |
inStream position:oldPos |
|
1702
75a595a70c86
stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents:
1571
diff
changeset
|
3803 |
]. |
516 | 3804 |
]. |
3805 |
^ values |
|
3975 | 3806 |
|
3807 |
"Modified: / 24-08-2017 / 23:35:38 / cg" |
|
516 | 3808 |
! |
3809 |
||
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3810 |
readShorts:nShorts signed:isSigned |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3811 |
"read nShorts signed or unsigned short numbers (16bit) and return them in an array" |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3812 |
|
3975 | 3813 |
|oldPos offset values msb val1 val2 val3 val4 |
516 | 3814 |
n "{ Class: SmallInteger }" | |
3815 |
||
3816 |
n := nShorts. |
|
3817 |
||
3818 |
msb := (byteOrder ~~ #lsb). |
|
3819 |
values := Array basicNew:n. |
|
3975 | 3820 |
(isBigTiff and:[ (n <= 4) ]) ifTrue:[ |
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3821 |
isSigned ifTrue:[ |
3552 | 3822 |
val1 := inStream nextInt16MSB:msb. |
3823 |
val2 := inStream nextInt16MSB:msb. |
|
3975 | 3824 |
val3 := inStream nextInt16MSB:msb. |
3825 |
val4 := inStream nextInt16MSB:msb. |
|
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3826 |
] ifFalse:[ |
3552 | 3827 |
val1 := inStream nextUnsignedInt16MSB:msb. |
3828 |
val2 := inStream nextUnsignedInt16MSB:msb. |
|
3975 | 3829 |
val3 := inStream nextUnsignedInt16MSB:msb. |
3830 |
val4 := inStream nextUnsignedInt16MSB:msb. |
|
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3831 |
]. |
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3832 |
values at:1 put:val1. |
3975 | 3833 |
(n >= 2) ifTrue:[ |
3834 |
values at:2 put:val2. |
|
3835 |
(n >= 3) ifTrue:[ |
|
3836 |
values at:3 put:val3. |
|
3837 |
(n == 4) ifTrue:[ |
|
3838 |
values at:4 put:val4. |
|
3839 |
] |
|
3840 |
] |
|
1702
75a595a70c86
stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents:
1571
diff
changeset
|
3841 |
] |
516 | 3842 |
] ifFalse:[ |
3975 | 3843 |
(n <= 2) ifTrue:[ |
1838
2476baed377c
make it compilable with old stc's, which do not care for the signed keyword.
Claus Gittinger <cg@exept.de>
parents:
1830
diff
changeset
|
3844 |
isSigned ifTrue:[ |
3552 | 3845 |
val1 := inStream nextInt16MSB:msb. |
3975 | 3846 |
val2 := inStream nextInt16MSB:msb. |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3847 |
] ifFalse:[ |
3552 | 3848 |
val1 := inStream nextUnsignedInt16MSB:msb. |
3975 | 3849 |
val2 := inStream nextUnsignedInt16MSB:msb. |
1829
af94d3366af3
tiff6 tag values added (signed byte,....)
Claus Gittinger <cg@exept.de>
parents:
1827
diff
changeset
|
3850 |
]. |
3975 | 3851 |
values at:1 put:val1. |
3852 |
(n == 2) ifTrue:[ |
|
3853 |
values at:2 put:val2 |
|
3854 |
] |
|
3855 |
] ifFalse:[ |
|
3856 |
offset := inStream nextInt32MSB:msb. |
|
3857 |
oldPos := inStream position. |
|
3858 |
inStream position:offset. |
|
3859 |
1 to:n do:[:index | |
|
3860 |
isSigned ifTrue:[ |
|
3861 |
val1 := inStream nextInt16MSB:msb. |
|
3862 |
] ifFalse:[ |
|
3863 |
val1 := inStream nextUnsignedInt16MSB:msb. |
|
3864 |
]. |
|
3865 |
values at:index put:val1 |
|
3866 |
]. |
|
3867 |
inStream position:oldPos |
|
1702
75a595a70c86
stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents:
1571
diff
changeset
|
3868 |
]. |
516 | 3869 |
]. |
3870 |
^ values |
|
3975 | 3871 |
|
3872 |
"Modified: / 24-08-2017 / 23:33:09 / cg" |
|
3984 | 3873 |
! |
3874 |
||
3875 |
readSingleTagFrom:aStream |
|
3876 |
|msb tagType numberType length| |
|
3877 |
||
3878 |
msb := (byteOrder == #msb). |
|
3879 |
||
3880 |
tagType := aStream nextUnsignedInt16MSB:msb. |
|
3881 |
numberType := aStream nextUnsignedInt16MSB:msb. |
|
3882 |
||
3883 |
isBigTiff ifFalse:[ |
|
3884 |
length := aStream nextInt32MSB:msb. |
|
3885 |
] ifTrue:[ |
|
3886 |
length := aStream nextInt64MSB:msb. |
|
3887 |
]. |
|
3888 |
self decodeTiffTag:tagType numberType:numberType length:length. |
|
3889 |
||
3890 |
"Created: / 26-08-2017 / 11:04:50 / cg" |
|
3891 |
"Modified (format): / 26-08-2017 / 22:37:58 / cg" |
|
3892 |
! |
|
3893 |
||
3894 |
readTagsFrom:aStream |
|
3895 |
|numberOfTags msb| |
|
3896 |
||
3897 |
msb := (byteOrder == #msb). |
|
3898 |
||
3899 |
isBigTiff ifFalse:[ |
|
3900 |
numberOfTags := aStream nextUnsignedInt16MSB:msb. |
|
3901 |
] ifTrue:[ |
|
3902 |
numberOfTags := aStream nextUnsignedInt64MSB:msb. |
|
3903 |
]. |
|
3904 |
1 to:numberOfTags do:[:index | |
|
3905 |
self readSingleTagFrom:aStream. |
|
3906 |
]. |
|
3907 |
||
3908 |
"Created: / 26-08-2017 / 11:03:45 / cg" |
|
516 | 3909 |
! ! |
3910 |
||
1762 | 3911 |
!TIFFReader methodsFor:'private-writing'! |
135 | 3912 |
|
3913 |
writeBitsPerSample |
|
14 | 3914 |
" |
135 | 3915 |
'bitsPerSample: ' print. bitsPerSample printNewline. |
3916 |
'store bitspersample at: ' print. outStream position printNewline. |
|
14 | 3917 |
" |
3211 | 3918 |
bitsPerSamplePos := outStream position. |
135 | 3919 |
bitsPerSample do:[:n | |
1785
16917d309b46
oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents:
1762
diff
changeset
|
3920 |
self writeShort:n |
135 | 3921 |
] |
0 | 3922 |
! |
3923 |
||
3924 |
writeColorMap |
|
28 | 3925 |
|n| |
3926 |
||
3211 | 3927 |
colorMapPos := outStream position. |
35 | 3928 |
#(red green blue) do:[:component | |
440 | 3929 |
n := 0. |
3930 |
colorMap do:[:clr | |
|
3931 |
|entry| |
|
35 | 3932 |
|
440 | 3933 |
clr isNil ifTrue:[ |
3934 |
entry := 0 |
|
3935 |
] ifFalse:[ |
|
3936 |
entry := clr perform:component. |
|
3937 |
" |
|
3938 |
tiff map is 16 bit - scale from percent to 0..16rFFFF |
|
3939 |
" |
|
3940 |
entry := (entry * 16rFFFF / 100) rounded. |
|
3941 |
]. |
|
3942 |
self writeShort:entry. |
|
3943 |
n := n + 1 |
|
3944 |
]. |
|
3945 |
||
3946 |
" |
|
3947 |
fill to 256 entries |
|
3948 |
" |
|
3949 |
[n < 256] whileTrue:[ |
|
3950 |
self writeShort:0. |
|
3951 |
n := n + 1. |
|
3952 |
] |
|
0 | 3953 |
] |
440 | 3954 |
|
3955 |
"Modified: 20.2.1997 / 18:06:10 / cg" |
|
0 | 3956 |
! |
3957 |
||
3958 |
writeStripByteCounts |
|
3 | 3959 |
" |
0 | 3960 |
'stripByteCounts: ' print. stripByteCounts printNewline. |
3961 |
'store stripbytecounts at: ' print. outStream position printNewline. |
|
3 | 3962 |
" |
3211 | 3963 |
stripByteCountsPos := outStream position. |
0 | 3964 |
stripByteCounts do:[:c | |
1785
16917d309b46
oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents:
1762
diff
changeset
|
3965 |
self writeShort:c |
0 | 3966 |
] |
3967 |
! |
|
3968 |
||
135 | 3969 |
writeStripOffsets |
3 | 3970 |
" |
135 | 3971 |
'stripOffsets: ' print. stripOffsets printNewline. |
3972 |
'store stripoffsets at: ' print. outStream position printNewline. |
|
3 | 3973 |
" |
3211 | 3974 |
stripOffsetsPos := outStream position. |
135 | 3975 |
stripOffsets do:[:o | |
1785
16917d309b46
oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents:
1762
diff
changeset
|
3976 |
self writeLong:o |
0 | 3977 |
] |
3978 |
! |
|
3979 |
||
3980 |
writeTag:tagType |
|
3981 |
self writeTiffTag:tagType. |
|
3982 |
! |
|
3983 |
||
3984 |
writeTiffTag:tagType |
|
3985 |
|value valueArray numberType count address| |
|
3986 |
||
3987 |
count := 1. |
|
3988 |
address := nil. |
|
3989 |
(tagType == 253) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3990 |
"tiff class" |
0 | 3991 |
]. |
3992 |
(tagType == 254) ifTrue:[ |
|
3993 |
]. |
|
3994 |
(tagType == 255) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3995 |
"SubfileType" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3996 |
value := subFileType. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3997 |
numberType := #long. |
0 | 3998 |
]. |
3999 |
(tagType == 256) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4000 |
"ImageWidth" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4001 |
value := width. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4002 |
numberType := #short. |
0 | 4003 |
]. |
4004 |
(tagType == 257) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4005 |
"ImageHeight" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4006 |
value := height. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4007 |
numberType := #short. |
0 | 4008 |
]. |
4009 |
(tagType == 258) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4010 |
"bitspersample" |
1785
16917d309b46
oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents:
1762
diff
changeset
|
4011 |
address := bitsPerSamplePos. |
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4012 |
numberType := #short. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4013 |
count := bitsPerSample size. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4014 |
valueArray := bitsPerSample |
0 | 4015 |
]. |
4016 |
(tagType == 259) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4017 |
"compression" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4018 |
value := compression. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4019 |
numberType := #short. |
0 | 4020 |
]. |
4021 |
(tagType == 262) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4022 |
"photometric" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4023 |
(photometric == #whiteIs0) ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4024 |
value := 0 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4025 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4026 |
(photometric == #blackIs0) ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4027 |
value := 1 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4028 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4029 |
(photometric == #rgb) ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4030 |
value := 2 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4031 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4032 |
(photometric == #palette) ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4033 |
value := 3 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4034 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4035 |
(photometric == #transparency) ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4036 |
value := 4 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4037 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4038 |
self error:'bad photometric' mayProceed:true. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4039 |
] |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4040 |
] |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4041 |
] |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4042 |
] |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4043 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4044 |
numberType := #short. |
0 | 4045 |
]. |
4046 |
(tagType == 263) ifTrue:[ |
|
4047 |
]. |
|
4048 |
(tagType == 264) ifTrue:[ |
|
4049 |
]. |
|
4050 |
(tagType == 265) ifTrue:[ |
|
4051 |
]. |
|
4052 |
(tagType == 266) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4053 |
"fillOrder" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4054 |
(fillOrder == #msb) ifTrue:[ |
3986 | 4055 |
value := FILLORDER_MSB2LSB |
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4056 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4057 |
(fillOrder == #lsb) ifTrue:[ |
3986 | 4058 |
value := FILLORDER_LSB2MSB |
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4059 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4060 |
self error:'bad fillOrder' mayProceed:true |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4061 |
] |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4062 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4063 |
numberType := #short. |
0 | 4064 |
]. |
4065 |
(tagType == 269) ifTrue:[ |
|
4066 |
]. |
|
4067 |
(tagType == 270) ifTrue:[ |
|
4068 |
]. |
|
4069 |
(tagType == 271) ifTrue:[ |
|
4070 |
]. |
|
4071 |
(tagType == 272) ifTrue:[ |
|
4072 |
]. |
|
4073 |
(tagType == 273) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4074 |
"stripoffsets" |
1785
16917d309b46
oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents:
1762
diff
changeset
|
4075 |
address := stripOffsetsPos. |
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4076 |
numberType := #long. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4077 |
count := stripOffsets size. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4078 |
valueArray := stripOffsets |
0 | 4079 |
]. |
4080 |
(tagType == 274) ifTrue:[ |
|
4081 |
]. |
|
4082 |
(tagType == 277) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4083 |
"samplesPerPixel" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4084 |
value := samplesPerPixel. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4085 |
numberType := #short. |
0 | 4086 |
]. |
4087 |
(tagType == 278) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4088 |
"rowsperstrip" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4089 |
value := rowsPerStrip. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4090 |
numberType := #short. |
0 | 4091 |
]. |
4092 |
(tagType == 279) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4093 |
"stripbytecount" |
1785
16917d309b46
oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents:
1762
diff
changeset
|
4094 |
address := stripByteCountsPos. |
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4095 |
numberType := #short. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4096 |
count := stripByteCounts size. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4097 |
valueArray := stripByteCounts |
0 | 4098 |
]. |
4099 |
(tagType == 280) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4100 |
"min sample value" |
0 | 4101 |
]. |
4102 |
(tagType == 281) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4103 |
"max sample value" |
0 | 4104 |
]. |
4105 |
(tagType == 282) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4106 |
"x resolution" |
0 | 4107 |
]. |
4108 |
(tagType == 283) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4109 |
"y resolution" |
0 | 4110 |
]. |
4111 |
(tagType == 284) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4112 |
"planarconfig" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4113 |
value := planarConfiguration. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4114 |
numberType := #short. |
0 | 4115 |
]. |
4116 |
(tagType == 285) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4117 |
"pageName" |
0 | 4118 |
]. |
4119 |
(tagType == 286) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4120 |
"xPosition" |
0 | 4121 |
]. |
4122 |
(tagType == 287) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4123 |
"yPosition" |
0 | 4124 |
]. |
4125 |
(tagType == 288) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4126 |
"freeOffsets" |
0 | 4127 |
]. |
4128 |
(tagType == 289) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4129 |
"freeByteCounts" |
0 | 4130 |
]. |
4131 |
(tagType == 290) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4132 |
"grayResponceUnit" |
0 | 4133 |
]. |
4134 |
(tagType == 291) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4135 |
"grayResponceCurve" |
0 | 4136 |
]. |
4137 |
(tagType == 292) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4138 |
"group3options" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4139 |
value := group3options. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4140 |
numberType := #long. |
0 | 4141 |
]. |
4142 |
(tagType == 293) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4143 |
"group4options" |
0 | 4144 |
]. |
4145 |
(tagType == 296) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4146 |
"resolutionunit" |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4147 |
^ self |
0 | 4148 |
]. |
4149 |
(tagType == 297) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4150 |
"pageNumber" |
0 | 4151 |
]. |
4152 |
(tagType == 300) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4153 |
"colorResponceUnit" |
0 | 4154 |
]. |
4155 |
(tagType == 301) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4156 |
"colorResponceCurve" |
0 | 4157 |
]. |
4158 |
(tagType == 306) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4159 |
"dateTime" |
0 | 4160 |
]. |
4161 |
(tagType == 315) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4162 |
"artist" |
0 | 4163 |
]. |
4164 |
(tagType == 317) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4165 |
"predictor" |
0 | 4166 |
]. |
4167 |
(tagType == 320) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4168 |
"colormap" |
1785
16917d309b46
oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents:
1762
diff
changeset
|
4169 |
address := colorMapPos. |
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4170 |
numberType := #short. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4171 |
count := 256 "(colorMap at:1) size" * 3. |
0 | 4172 |
]. |
4173 |
||
4174 |
(value isNil and:[address isNil]) ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4175 |
self error:'unhandled tag' mayProceed:true. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4176 |
^ self |
0 | 4177 |
]. |
4178 |
||
14 | 4179 |
" |
0 | 4180 |
'tag:' print. tagType print. ' typ:' print. numberType print. |
4181 |
' len:' print. count print. |
|
4182 |
' val:' print. value printNewline. |
|
14 | 4183 |
" |
0 | 4184 |
|
4185 |
self writeShort:tagType. |
|
4186 |
numberType == #short ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4187 |
self writeShort:3. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4188 |
self writeLong:count. |
0 | 4189 |
] ifFalse:[ |
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4190 |
numberType == #long ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4191 |
self writeShort:4. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4192 |
self writeLong:count. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4193 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4194 |
numberType == #byte ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4195 |
self writeShort:1. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4196 |
self writeLong:count. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4197 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4198 |
self error:'bad numbertype' |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4199 |
] |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4200 |
] |
0 | 4201 |
]. |
4202 |
address notNil ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4203 |
(numberType == #long and:[count == 1]) ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4204 |
self writeLong:(valueArray at:1). |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4205 |
^ self |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4206 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4207 |
(numberType == #short and:[count <= 2]) ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4208 |
self writeShort:(valueArray at:1). |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4209 |
count == 2 ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4210 |
self writeShort:(valueArray at:2). |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4211 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4212 |
self writeShort:0 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4213 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4214 |
^ self |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4215 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4216 |
(numberType == #byte and:[count <= 4]) ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4217 |
outStream nextPut:(valueArray at:1). |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4218 |
count > 1 ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4219 |
outStream nextPut:(valueArray at:2). |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4220 |
count > 2 ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4221 |
outStream nextPut:(valueArray at:3). |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4222 |
count > 3 ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4223 |
outStream nextPut:(valueArray at:4). |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4224 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4225 |
outStream nextPut:0 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4226 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4227 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4228 |
outStream nextPut:0 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4229 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4230 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4231 |
outStream nextPut:0 |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4232 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4233 |
^ self |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4234 |
]. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4235 |
self writeLong:address. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4236 |
^ self |
0 | 4237 |
]. |
4238 |
numberType == #short ifTrue:[ |
|
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4239 |
self writeShort:value. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4240 |
self writeShort:0 |
0 | 4241 |
] ifFalse:[ |
1215
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4242 |
numberType == #long ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4243 |
self writeLong:value |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4244 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4245 |
numberType == #byte ifTrue:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4246 |
outStream nextPut:value. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4247 |
outStream nextPut:0. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4248 |
outStream nextPut:0. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4249 |
outStream nextPut:0. |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4250 |
] ifFalse:[ |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4251 |
self error:'bad numbertype' |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4252 |
] |
e40392a58092
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4253 |
] |
0 | 4254 |
]. |
3986 | 4255 |
|
4256 |
"Modified: / 28-08-2017 / 00:47:52 / cg" |
|
0 | 4257 |
! |
4258 |
||
135 | 4259 |
writeUncompressedBits |
4260 |
"write bits as one or multiple strips" |
|
4261 |
||
4262 |
|offs bytesPerRow nBytes |
|
4263 |
h "{ Class: SmallInteger }"| |
|
0 | 4264 |
|
135 | 4265 |
nBytes := data size. |
4266 |
nBytes < 16rFFFF ifTrue:[ |
|
3211 | 4267 |
stripOffsets := Array with:(outStream position). |
1703
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4268 |
stripByteCounts := Array with:nBytes. |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4269 |
outStream nextPutBytes:nBytes from:data. |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4270 |
rowsPerStrip := height |
135 | 4271 |
] ifFalse:[ |
1703
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4272 |
stripOffsets := Array basicNew:height. |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4273 |
bytesPerRow := nBytes // height. |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4274 |
stripByteCounts := (Array basicNew:height) atAllPut:bytesPerRow. |
0 | 4275 |
|
1703
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4276 |
offs := 1. |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4277 |
h := height. |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4278 |
1 to:h do:[:row | |
3211 | 4279 |
stripOffsets at:row put:(outStream position). |
1703
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4280 |
outStream nextPutBytes:bytesPerRow from:data startingAt:offs. |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4281 |
offs := offs + bytesPerRow |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4282 |
]. |
5a08db3f0013
prep for 0-based stream position
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
4283 |
rowsPerStrip := 1 |
135 | 4284 |
]. |
4285 |
" |
|
4286 |
'stripOffsets: ' print. stripOffsets printNewline. |
|
4287 |
'stripByteCounts: ' print. stripByteCounts printNewline. |
|
4288 |
" |
|
4289 |
! ! |
|
4290 |
||
1805 | 4291 |
!TIFFReader methodsFor:'reading'! |
135 | 4292 |
|
4293 |
fromStream:aStream |
|
192 | 4294 |
"read a stream containing a TIFF image. |
3899 | 4295 |
Leave image description in instance variables. |
4296 |
(i.e. to get the image, ask with image)." |
|
135 | 4297 |
|
3984 | 4298 |
|char1 char2 version offset msb |
4299 |
bytesPerRow img moreIfds| |
|
135 | 4300 |
|
4301 |
inStream := aStream. |
|
331
304f9c439efa
allow reading from ByteArray-readStreams
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
4302 |
aStream binary. |
135 | 4303 |
|
4304 |
char1 := aStream next. |
|
4305 |
char2 := aStream next. |
|
3975 | 4306 |
|
4307 |
"/ first two chars are either II (intel byte order) |
|
4308 |
"/ or MM (motorola byte orrder) |
|
135 | 4309 |
(char1 ~~ char2) ifTrue:[ |
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
4310 |
^ self fileFormatError:'not a tiff file'. |
135 | 4311 |
]. |
1953
90f3c42ef3c1
Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
1846
diff
changeset
|
4312 |
(char1 == $I codePoint) ifTrue:[ |
192 | 4313 |
byteOrder := #lsb. |
4314 |
msb := false. |
|
0 | 4315 |
] ifFalse:[ |
1953
90f3c42ef3c1
Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
1846
diff
changeset
|
4316 |
(char1 == $M codePoint) ifTrue:[ |
192 | 4317 |
byteOrder := #msb. |
4318 |
msb := true. |
|
4319 |
] ifFalse:[ |
|
814
6240dfc2fd3b
use common fileFormatError reporter
Claus Gittinger <cg@exept.de>
parents:
744
diff
changeset
|
4320 |
^ self fileFormatError:'not a tiff file'. |
192 | 4321 |
] |
0 | 4322 |
]. |
3975 | 4323 |
|
3974 | 4324 |
version := aStream nextUnsignedInt16MSB:msb. |
4325 |
(version == 42) ifTrue:[ |
|
3984 | 4326 |
isBigTiff := false. |
3974 | 4327 |
] ifFalse:[ |
4328 |
(version == 43) ifTrue:[ |
|
4329 |
|byteSizeOfOffsets always0| |
|
3975 | 4330 |
|
3974 | 4331 |
"/ 43 is the proposed bigtiff format |
3975 | 4332 |
isBigTiff := true. |
3974 | 4333 |
byteSizeOfOffsets := aStream nextUnsignedInt16MSB:msb. |
4334 |
byteSizeOfOffsets == 8 ifFalse:[ |
|
4335 |
^ self fileFormatError:'version of bigtiff-file not supported'. |
|
4336 |
]. |
|
4337 |
always0 := aStream nextUnsignedInt16MSB:msb. |
|
3975 | 4338 |
always0 == 0 ifFalse:[ |
3974 | 4339 |
^ self fileFormatError:'version of bigtiff-file not supported'. |
4340 |
]. |
|
4341 |
] ifFalse:[ |
|
4342 |
^ self fileFormatError:'version of tiff-file not supported'. |
|
4343 |
]. |
|
0 | 4344 |
]. |
4345 |
||
3984 | 4346 |
imageSequence := ImageSequence new. |
4347 |
isDNGImage := false. |
|
4348 |
||
4349 |
isBigTiff ifFalse:[ |
|
4350 |
offset := aStream nextUnsignedInt32MSB:msb. |
|
4351 |
] ifTrue:[ |
|
4352 |
offset := aStream nextUnsignedInt64MSB:msb. |
|
4353 |
]. |
|
4354 |
||
4355 |
[ offset ~~ 0 ] whileTrue:[ |
|
4356 |
Verbose == true ifTrue:[ |
|
4357 |
Logger info:'------------------ reading image #%1 ------------------' with:imageSequence size+1. |
|
4358 |
]. |
|
4359 |
||
4360 |
aStream position:offset. |
|
4361 |
||
4362 |
"setup default values" |
|
4363 |
metaData := TIFFMetaData new. |
|
4364 |
||
4365 |
compression := 1. "none" |
|
4366 |
fillOrder := #msb. |
|
4367 |
planarConfiguration := PLANARCONFIG_CONTIG. |
|
4368 |
photometric := nil. |
|
3986 | 4369 |
bitsPerSample := nil. |
3984 | 4370 |
samplesPerPixel := 1. |
4371 |
width := height := nil. |
|
4372 |
stripOffsets := stripByteCounts := rowsPerStrip := nil. |
|
4373 |
"resolutionUnit := 2." |
|
4374 |
predictor := 1. |
|
4375 |
group3options := nil. |
|
4376 |
orientation := nil. |
|
4377 |
subFileType := subIfds := nil. |
|
3986 | 4378 |
sampleFormat := SAMPLEFORMAT_UINT. |
4379 |
minSampleValue := maxSampleValue := nil. |
|
3984 | 4380 |
tileWidth := tileLength := tileOffsets := tileByteCounts := nil. |
4381 |
||
4382 |
self readTagsFrom:aStream. |
|
4383 |
"/ read the next offset now, |
|
4384 |
"/ because the stream's position will be changed when the image-data is read |
|
4385 |
isBigTiff ifFalse:[ |
|
4386 |
offset := aStream nextUnsignedInt32MSB:msb. |
|
4387 |
] ifTrue:[ |
|
4388 |
offset := aStream nextUnsignedInt64MSB:msb. |
|
4389 |
]. |
|
4390 |
||
4391 |
"check for required tags" |
|
4392 |
width isNil ifTrue:[ ^ self fileFormatError:'missing width tag' ]. |
|
4393 |
height isNil ifTrue:[ ^ self fileFormatError:'missing length tag' ]. |
|
3986 | 4394 |
bitsPerSample isNil ifTrue:[ |
4395 |
bitsPerSample := Array new:samplesPerPixel withAll:1. |
|
4396 |
]. |
|
4397 |
||
4398 |
photometric isNil ifTrue:[ |
|
4399 |
"/ try to repair |
|
4400 |
bitsPerSample sum == 1 ifTrue:[ |
|
4401 |
photometric := #whiteIs0. |
|
4402 |
] ifFalse:[ |
|
4403 |
^ self fileFormatError:'missing photometric tag' |
|
4404 |
]. |
|
4405 |
]. |
|
3984 | 4406 |
|
4407 |
"given all the information, read the bits" |
|
4408 |
tileWidth notNil ifTrue:[ |
|
4409 |
tileOffsets := tileOffsets ? stripOffsets. |
|
4410 |
tileByteCounts := tileByteCounts ? stripByteCounts. |
|
4411 |
(tileOffsets notNil |
|
4412 |
and:[tileLength notNil |
|
4413 |
and:[tileByteCounts notNil ]] |
|
4414 |
) ifFalse:[ |
|
4415 |
^ self fileFormatError:'missing stripOffsets (or tileOffsets)'. |
|
4416 |
]. |
|
4417 |
self reportDimension. |
|
4418 |
self readTiledTiffImageData. |
|
4419 |
] ifFalse:[ |
|
4420 |
stripByteCounts isNil ifTrue:[ |
|
4421 |
stripOffsets size == 1 ifTrue:[ |
|
4422 |
stripByteCounts := Array with:(self bitsPerPixel // 8) * width * height |
|
4423 |
] ifFalse:[ |
|
4424 |
^ self fileFormatError:'missing stripByteCounts'. |
|
4425 |
]. |
|
4426 |
]. |
|
4427 |
rowsPerStrip isNil ifTrue:[ |
|
4428 |
rowsPerStrip := height |
|
4429 |
]. |
|
4430 |
self reportDimension. |
|
4431 |
self readTiffImageData. |
|
4432 |
]. |
|
3693 | 4433 |
|
3986 | 4434 |
orientation notNil ifTrue:[ |
4435 |
orientation == #unsupported ifTrue:[ |
|
4436 |
'TIFFReader [warning]: unsupported orientation' errorPrintCR |
|
4437 |
] ifFalse:[ |
|
4438 |
orientation == #vFlip ifTrue:[ |
|
4439 |
|tmp offset1 offset2| |
|
4440 |
||
4441 |
"/ reverse rows to top-to bottom |
|
4442 |
"/ (oops - depends on side-effecting the data array) |
|
4443 |
||
4444 |
bytesPerRow := self bytesPerRow. |
|
4445 |
tmp := ByteArray new:bytesPerRow. |
|
4446 |
offset1 := 1. |
|
4447 |
offset2 := (height-1)*bytesPerRow + 1. |
|
4448 |
0 to:((height-1)//2) do:[:row | |
|
4449 |
tmp replaceFrom:1 to:bytesPerRow with:data startingAt:offset1. |
|
4450 |
data replaceFrom:offset1 to:(offset1+bytesPerRow-1) with:data startingAt:offset2. |
|
4451 |
data replaceFrom:offset2 to:(offset2+bytesPerRow-1) with:tmp startingAt:1. |
|
4452 |
offset1 := offset1 + bytesPerRow. |
|
4453 |
offset2 := offset2 - bytesPerRow. |
|
4454 |
]. |
|
3984 | 4455 |
]. |
4456 |
]. |
|
4457 |
]. |
|
3986 | 4458 |
|
3984 | 4459 |
"/ fixup photoetric |
4460 |
photometric == #rgb ifTrue:[ |
|
4461 |
samplesPerPixel == 4 ifTrue:[ |
|
4462 |
photometric := #rgba |
|
4463 |
]. |
|
4464 |
]. |
|
4465 |
||
4466 |
img := self makeImage. |
|
4467 |
img imageSequence:imageSequence. |
|
4468 |
imageSequence add:(ImageFrame new image:img). |
|
4469 |
||
4470 |
offset == 0 ifTrue:[ |
|
4471 |
moreIfds isNil ifTrue:[ |
|
4472 |
subIfds notNil ifTrue:[ |
|
4473 |
(isDNGImage not or:[loadFullResolutionImage == true]) ifTrue:[ |
|
4474 |
moreIfds := OrderedCollection withAll:subIfds. |
|
4475 |
subIfds := nil. |
|
4476 |
] ifFalse:[ |
|
4477 |
Verbose == true ifTrue:[ |
|
4478 |
Logger info:'skip high resolution images (use loadFullResolutionImage is false)' |
|
4479 |
]. |
|
4480 |
]. |
|
4481 |
]. |
|
4482 |
]. |
|
4483 |
moreIfds notEmptyOrNil ifTrue:[ |
|
4484 |
offset := moreIfds removeFirst |
|
4485 |
]. |
|
4486 |
]. |
|
135 | 4487 |
]. |
4488 |
||
3984 | 4489 |
imageSequence size > 1 ifTrue:[ |
4490 |
Verbose == true ifTrue:[ |
|
4491 |
Logger info:'read %1 images' with:imageSequence size |
|
4492 |
]. |
|
4493 |
]. |
|
4494 |
^ self |
|
4495 |
||
3986 | 4496 |
"Modified: / 27-08-2017 / 23:24:37 / cg" |
135 | 4497 |
! ! |
0 | 4498 |
|
1805 | 4499 |
!TIFFReader methodsFor:'writing'! |
135 | 4500 |
|
1571 | 4501 |
save:image onStream:aStream |
4502 |
"save image as (uncompressed) TIFF file on aFileName" |
|
4503 |
||
4504 |
|pos1 pos indicator| |
|
0 | 4505 |
|
1078
fc33e172bbbc
raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
4506 |
image mask notNil ifTrue:[ |
fc33e172bbbc
raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
4507 |
Image informationLostQuerySignal |
fc33e172bbbc
raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
4508 |
raiseWith:image |
fc33e172bbbc
raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
4509 |
errorString:('TIFF writer does not (yet) support an imageMask'). |
fc33e172bbbc
raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
4510 |
]. |
fc33e172bbbc
raise informationLostSignal before attemting to write the file
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
4511 |
|
1571 | 4512 |
outStream := aStream. |
4513 |
outStream binary. |
|
461
bacef118f54a
more signals to be raised if anything happens during
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
4514 |
|
135 | 4515 |
"save as msb" |
4516 |
||
4517 |
byteOrder := #msb. |
|
4518 |
" |
|
4519 |
byteOrder := #lsb. |
|
4520 |
" |
|
4521 |
fillOrder := #msb. |
|
4522 |
width := image width. |
|
4523 |
height := image height. |
|
4524 |
photometric := image photometric. |
|
4525 |
samplesPerPixel := image samplesPerPixel. |
|
4526 |
bitsPerSample := image bitsPerSample. |
|
1785
16917d309b46
oops - position incompatibility fixed
Claus Gittinger <cg@exept.de>
parents:
1762
diff
changeset
|
4527 |
|
135 | 4528 |
colorMap := image colorMap. |
3984 | 4529 |
planarConfiguration := PLANARCONFIG_CONTIG. |
135 | 4530 |
compression := 1. "none" |
4531 |
data := image bits. |
|
4532 |
||
4533 |
currentOffset := 0. |
|
4534 |
||
4535 |
(byteOrder == #msb) ifTrue:[ |
|
1953
90f3c42ef3c1
Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
1846
diff
changeset
|
4536 |
indicator := $M codePoint. |
135 | 4537 |
] ifFalse:[ |
1953
90f3c42ef3c1
Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
1846
diff
changeset
|
4538 |
indicator := $I codePoint. |
0 | 4539 |
]. |
1571 | 4540 |
outStream nextPut:indicator; nextPut:indicator. |
135 | 4541 |
currentOffset := currentOffset + 2. |
0 | 4542 |
|
135 | 4543 |
self writeShort:42. |
4544 |
currentOffset := currentOffset + 2. |
|
0 | 4545 |
|
135 | 4546 |
pos1 := outStream position. |
4547 |
self writeLong:0. "start of tags - filled in later" |
|
4548 |
currentOffset := currentOffset + 4. |
|
4549 |
||
4550 |
"output strips" |
|
4551 |
||
4552 |
self writeUncompressedBits. "this outputs bits as strips, sets stripOffsets and stripByteCounts" |
|
4553 |
self writeStripOffsets. "this outputs strip offsets, sets stripOffsetsPos" |
|
4554 |
self writeStripByteCounts. "this outputs strip bytecounts, sets stripByteCountPos" |
|
4555 |
self writeBitsPerSample. "this outputs bitsPerSample, sets bitsPerSamplePos" |
|
4556 |
photometric == #palette ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
4557 |
self writeColorMap "this outputs colorMap, sets colorMapPos" |
0 | 4558 |
]. |
4559 |
||
3211 | 4560 |
pos := outStream position. "backpatch tag offset" |
135 | 4561 |
outStream position:pos1. |
1704
1526c7b84920
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
1703
diff
changeset
|
4562 |
self writeLong:pos. "fill in tag offset" |
3211 | 4563 |
outStream position:pos. |
135 | 4564 |
" |
4565 |
('patch tag offset at: ', (pos1 printStringRadix:16) , ' to ', |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
4566 |
(pos printStringRadix:16)) printNewline. |
135 | 4567 |
" |
4568 |
"output tag data" |
|
0 | 4569 |
|
135 | 4570 |
photometric == #palette ifTrue:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
4571 |
self writeShort:11. "11 tags" |
135 | 4572 |
] ifFalse:[ |
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
4573 |
self writeShort:10. "10 tags" |
135 | 4574 |
]. |
4575 |
self writeTag:256. "image width" |
|
4576 |
self writeTag:257. "image height" |
|
4577 |
self writeTag:258. "bits per sample" |
|
4578 |
self writeTag:259. "compression" |
|
4579 |
self writeTag:262. "photometric" |
|
4580 |
self writeTag:273. "strip offsets" |
|
159
327da5085900
fixed saving of 24bit RGB images (forgot samplesPerPixel-TAG)
Claus Gittinger <cg@exept.de>
parents:
135
diff
changeset
|
4581 |
self writeTag:277. "samplesPerPixel" |
135 | 4582 |
self writeTag:278. "rowsPerStrip" |
4583 |
self writeTag:279. "strip byte counts" |
|
4584 |
self writeTag:284. "planarconfig" |
|
4585 |
photometric == #palette ifTrue:[ |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
4586 |
self writeTag:320 "colorMap" |
135 | 4587 |
]. |
4588 |
self writeLong:0. "end of tags mark" |
|
3984 | 4589 |
|
4590 |
"Modified: / 27-08-2017 / 13:36:35 / cg" |
|
135 | 4591 |
! ! |
30 | 4592 |
|
357
4bcb93f5892e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
336
diff
changeset
|
4593 |
!TIFFReader class methodsFor:'documentation'! |
30 | 4594 |
|
135 | 4595 |
version |
3552 | 4596 |
^ '$Header$' |
3976 | 4597 |
! |
4598 |
||
4599 |
version_CVS |
|
4600 |
^ '$Header$' |
|
0 | 4601 |
! ! |
1702
75a595a70c86
stream position is going to be 0-based soon
Claus Gittinger <cg@exept.de>
parents:
1571
diff
changeset
|
4602 |
|
3112 | 4603 |
|
135 | 4604 |
TIFFReader initialize! |