diff --git a/imageio/imageio-tiff/src/main/java/com/twelvemonkeys/imageio/plugins/tiff/TIFFImageWriter.java b/imageio/imageio-tiff/src/main/java/com/twelvemonkeys/imageio/plugins/tiff/TIFFImageWriter.java index 37f7e6d9..72d5f9a3 100644 --- a/imageio/imageio-tiff/src/main/java/com/twelvemonkeys/imageio/plugins/tiff/TIFFImageWriter.java +++ b/imageio/imageio-tiff/src/main/java/com/twelvemonkeys/imageio/plugins/tiff/TIFFImageWriter.java @@ -505,7 +505,7 @@ public final class TIFFImageWriter extends ImageWriterBase { case TIFFExtension.COMPRESSION_LZW: stream = IIOUtil.createStreamAdapter(imageOutput); - stream = new EncoderStream(stream, new LZWEncoder((image.getTileWidth() * image.getTileHeight() * samplesPerPixel * bitPerSample + 7) / 8)); + stream = new EncoderStream(stream, new LZWEncoder(((image.getTileWidth() * samplesPerPixel * bitPerSample + 7) / 8) * image.getTileHeight())); if (entries.containsKey(TIFF.TAG_PREDICTOR) && entries.get(TIFF.TAG_PREDICTOR).getValue().equals(TIFFExtension.PREDICTOR_HORIZONTAL_DIFFERENCING)) { stream = new HorizontalDifferencingStream(stream, image.getTileWidth(), samplesPerPixel, bitPerSample, imageOutput.getByteOrder()); } diff --git a/imageio/imageio-tiff/src/test/java/com/twelvemonkeys/imageio/plugins/tiff/TIFFImageWriterTest.java b/imageio/imageio-tiff/src/test/java/com/twelvemonkeys/imageio/plugins/tiff/TIFFImageWriterTest.java index 6a313950..068575ff 100644 --- a/imageio/imageio-tiff/src/test/java/com/twelvemonkeys/imageio/plugins/tiff/TIFFImageWriterTest.java +++ b/imageio/imageio-tiff/src/test/java/com/twelvemonkeys/imageio/plugins/tiff/TIFFImageWriterTest.java @@ -937,6 +937,45 @@ public class TIFFImageWriterTest extends ImageWriterAbstractTestCase { getClassLoaderResource("/tiff/ColorCheckerCalculator.tif"), getClassLoaderResource("/tiff/quad-jpeg.tif"), getClassLoaderResource("/tiff/quad-lzw.tif"), + getClassLoaderResource("/tiff/bali.tif"), + getClassLoaderResource("/tiff/lzw-colormap-iiobe.tif"), + // TODO: FixMe for ColorMap + ExtraSamples (custom ColorModel) +// getClassLoaderResource("/tiff/colormap-with-extrasamples.tif"), + + getClassLoaderResource("/tiff/depth/flower-minisblack-02.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-04.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-06.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-08.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-10.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-12.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-14.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-16.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-24.tif"), + getClassLoaderResource("/tiff/depth/flower-minisblack-32.tif"), + + getClassLoaderResource("/tiff/depth/flower-palette-02.tif"), + getClassLoaderResource("/tiff/depth/flower-palette-04.tif"), + getClassLoaderResource("/tiff/depth/flower-palette-08.tif"), + getClassLoaderResource("/tiff/depth/flower-palette-16.tif"), + + getClassLoaderResource("/tiff/depth/flower-rgb-contig-08.tif"), + // TODO: FixMe for RGB > 8 bits / sample +// getClassLoaderResource("/tiff/depth/flower-rgb-contig-10.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-contig-12.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-contig-14.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-contig-16.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-contig-24.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-contig-32.tif"), + + getClassLoaderResource("/tiff/depth/flower-rgb-planar-08.tif"), + // TODO: FixMe for planar RGB > 8 bits / sample +// getClassLoaderResource("/tiff/depth/flower-rgb-planar-10.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-planar-12.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-planar-14.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-planar-16.tif"), +// getClassLoaderResource("/tiff/depth/flower-rgb-planar-24.tif"), + + getClassLoaderResource("/tiff/scan-mono-iccgray.tif"), getClassLoaderResource("/tiff/old-style-jpeg-inconsistent-metadata.tif"), getClassLoaderResource("/tiff/ccitt/group3_1d.tif"), getClassLoaderResource("/tiff/ccitt/group3_2d.tif"), @@ -1003,7 +1042,7 @@ public class TIFFImageWriterTest extends ImageWriterAbstractTestCase { if (info.compression == TIFFExtension.COMPRESSION_OLD_JPEG) { // Should rewrite this from old-style to new style - assertEquals("Old JPEG compression not rewritten as JPEG", TIFFExtension.COMPRESSION_JPEG, afterCompressionEntry.getValue()); + assertEquals("Old JPEG compression not rewritten as JPEG", TIFFExtension.COMPRESSION_JPEG, ((Number) afterCompressionEntry.getValue()).intValue()); } else { assertEquals("Compression differs from original", info.compression, ((Number) afterCompressionEntry.getValue()).intValue());