if (ostream == null) {
throw new TranscoderException(
Messages.formatMessage("tiff.badoutput", null));
}
TIFFEncodeParam params = new TIFFEncodeParam();
float PixSzMM = userAgent.getPixelUnitToMillimeter();
// num Pixs in 100 Meters
int numPix = (int)(((1000*100)/PixSzMM)+0.5);
int denom = 100*100; // Centimeters per 100 Meters;
long [] rational = {(long)numPix, (long)denom};
TIFFField [] fields = {
new TIFFField(TIFFImageDecoder.TIFF_RESOLUTION_UNIT,
TIFFField.TIFF_SHORT, 1,
new char [] { (char)3 }),
new TIFFField(TIFFImageDecoder.TIFF_X_RESOLUTION,
TIFFField.TIFF_RATIONAL, 1,
new long [][] { rational }),
new TIFFField(TIFFImageDecoder.TIFF_Y_RESOLUTION,
TIFFField.TIFF_RATIONAL, 1,
new long [][] { rational })
};
params.setExtraFields(fields);
//
// This is a trick so that viewers which do not support the alpha
// channel will see a white background (and not a black one).
//