public TIFFRenderedImage( TIFFImageReader reader, int imageIndex, ImageReadParam readParam, int width, int height) throws IOException { this.reader = reader; this.imageIndex = imageIndex; this.tileParam = cloneImageReadParam(readParam, false); this.subsampleX = tileParam.getSourceXSubsampling(); this.subsampleY = tileParam.getSourceYSubsampling(); this.isSubsampling = this.subsampleX != 1 || this.subsampleY != 1; this.width = width / subsampleX; this.height = height / subsampleY; // If subsampling is being used, we may not match the // true tile grid exactly, but everything should still work this.tileWidth = reader.getTileWidth(imageIndex) / subsampleX; this.tileHeight = reader.getTileHeight(imageIndex) / subsampleY; Iterator iter = reader.getImageTypes(imageIndex); this.its = (ImageTypeSpecifier) iter.next(); tileParam.setDestinationType(its); }