190
191 TIFFField f = dir.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH);
192 check(f.getCount() == 1, "invalid width field count");
193 int w = f.getAsInt(0);
194 check(w == SZ, "invalid width");
195
196 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_LENGTH);
197 check(f.getCount() == 1, "invalid height field count");
198 int h = f.getAsInt(0);
199 check(h == SZ, "invalid height");
200
201 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_BITS_PER_SAMPLE);
202 // RGB: 3 x 8 bits for R, G and B components
203 int bps[] = f.getAsInts();
204 check((f.getCount() == 3) && (bps.length == 3), "invalid BPS count");
205 for (int b: bps) { check(b == 8, "invalid bits per sample"); }
206
207 // RGB: PhotometricInterpretation = 2
208 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_PHOTOMETRIC_INTERPRETATION);
209 check(f.getCount() == 1, "invalid count");
210 check(f.getAsInt(0) == 2, "invalid photometric interpretation for RGB");
211
212 String rat = " resolution must be rational";
213 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_X_RESOLUTION);
214 check(f.getType() == TIFFTag.TIFF_RATIONAL, "x" + rat);
215 check(f.getCount() == 1 &&
216 f.getAsInt(0) == (int) (RES_X[0][0] / RES_X[0][1]),
217 "invalid x resolution");
218
219 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_Y_RESOLUTION);
220 check(f.getType() == TIFFTag.TIFF_RATIONAL, "y" + rat);
221 check(f.getCount() == 1 &&
222 f.getAsInt(0) == (int) (RES_Y[0][0] / RES_Y[0][1]),
223 "invalid y resolution");
224
225 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_ICC_PROFILE);
226 check(f.getType() == TIFFTag.TIFF_UNDEFINED,
227 "invalid ICC profile field type");
228 int cnt = f.getCount();
229 byte icc[] = f.getAsBytes();
230 check((cnt == ICC_PROFILE.length) && (cnt == icc.length),
|
190
191 TIFFField f = dir.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH);
192 check(f.getCount() == 1, "invalid width field count");
193 int w = f.getAsInt(0);
194 check(w == SZ, "invalid width");
195
196 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_LENGTH);
197 check(f.getCount() == 1, "invalid height field count");
198 int h = f.getAsInt(0);
199 check(h == SZ, "invalid height");
200
201 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_BITS_PER_SAMPLE);
202 // RGB: 3 x 8 bits for R, G and B components
203 int bps[] = f.getAsInts();
204 check((f.getCount() == 3) && (bps.length == 3), "invalid BPS count");
205 for (int b: bps) { check(b == 8, "invalid bits per sample"); }
206
207 // RGB: PhotometricInterpretation = 2
208 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_PHOTOMETRIC_INTERPRETATION);
209 check(f.getCount() == 1, "invalid count");
210 check(f.getAsInt(0) == BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_RGB,
211 "invalid photometric interpretation value");
212
213 String rat = " resolution must be rational";
214 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_X_RESOLUTION);
215 check(f.getType() == TIFFTag.TIFF_RATIONAL, "x" + rat);
216 check(f.getCount() == 1 &&
217 f.getAsInt(0) == (int) (RES_X[0][0] / RES_X[0][1]),
218 "invalid x resolution");
219
220 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_Y_RESOLUTION);
221 check(f.getType() == TIFFTag.TIFF_RATIONAL, "y" + rat);
222 check(f.getCount() == 1 &&
223 f.getAsInt(0) == (int) (RES_Y[0][0] / RES_Y[0][1]),
224 "invalid y resolution");
225
226 f = dir.getTIFFField(BaselineTIFFTagSet.TAG_ICC_PROFILE);
227 check(f.getType() == TIFFTag.TIFF_UNDEFINED,
228 "invalid ICC profile field type");
229 int cnt = f.getCount();
230 byte icc[] = f.getAsBytes();
231 check((cnt == ICC_PROFILE.length) && (cnt == icc.length),
|