[
https://issues.apache.org/jira/browse/IMAGING-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16888465#comment-16888465
]
Bruno P. Kinoshita commented on IMAGING-231:
--------------------------------------------
Tried using ImageIO to read the data. i.e.
{code:java}
BufferedImage bufferedImage = Imaging.getBufferedImage(f, params);
// discard old data, read with JDK ImageIO
bufferedImage = ImageIO.read(f);{code}
It resulted in null on JDK 8. Then switched to JDK 11 (for
[http://openjdk.java.net/jeps/262] from JDK 9), and it resulted in the
following exception:
{noformat}
SINGLE PAGE!
Exception in thread "main" javax.imageio.IIOException: 16-bit samples are not
supported for Horizontal differencing Predictor
at
java.desktop/com.sun.imageio.plugins.tiff.TIFFLZWDecompressor.decodeRaw(TIFFLZWDecompressor.java:89)
at
java.desktop/com.sun.imageio.plugins.tiff.TIFFDecompressor.decodeRaw(TIFFDecompressor.java:1907)
at
java.desktop/com.sun.imageio.plugins.tiff.TIFFDecompressor.decode(TIFFDecompressor.java:2549)
at
java.desktop/com.sun.imageio.plugins.tiff.TIFFImageReader.decodeTile(TIFFImageReader.java:1124)
at
java.desktop/com.sun.imageio.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:1342)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1468)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1315)
at org.apache.commons.imaging.TTT.main(TTT.java:31){noformat}
> Reading tiff with LZW compression results in mangled image
> ----------------------------------------------------------
>
> Key: IMAGING-231
> URL: https://issues.apache.org/jira/browse/IMAGING-231
> Project: Commons Imaging
> Issue Type: Bug
> Components: Format: TIFF
> Affects Versions: 1.0-alpha1
> Reporter: Jimmy Merrild Krag
> Priority: Major
> Attachments: image_pages.zip, result.pdf
>
>
> I am trying to create a PDF using PDFbox with Commons Imaging for loading
> images. Commons imaging fixes most of the issues I have with the
> alternatives, but still cannot load my tiff files correctly.
> I have attached a resulting PDF as {{result.pdf}}.
> The files I use for testing, are attached in {{image_pages.zip}}. The
> tiff-files, which are not loaded correctly, are LZW-compressed, and that is
> the only difference I can find in the format.
> All images look the same if I save them to separate image files in another
> format, as they do in the PDF, so PDFbox does not seem to be the one to
> blame. My code for reading the files is pretty straightforward:
>
> {code:java}
> ImageInfo imageInfo = Imaging.getImageInfo(imageBytes);
> if (imageInfo.getNumberOfImages() > 1) {
> List<BufferedImage> allBufferedImages =
> Imaging.getAllBufferedImages(imageBytes);
> for (BufferedImage bufferedImage : allBufferedImages) {
> appendImagePage(bufferedImage);
> }
> } else {
> appendImagePage(Imaging.getBufferedImage(imageBytes));
> }
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)