incubator-sanselan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Theisen (JIRA)" <>
Subject [jira] Commented: (SANSELAN-14) Two issues with BMPs.
Date Thu, 04 Dec 2008 06:26:44 GMT


Kevin Theisen commented on SANSELAN-14:

Hi Charles,

I checked all my IO objects. The byte[] from Sanselan is 1666 in length. ByteArrayOutputStream.toByteArray().length
also returns 1666. That output stream is used to initialize a ByteArrayInputStream that is
sent to Sanselan. I cannot find a case where the data is being truncated.

That being said, your reasoning is probably correct, I just can't think of where the data
is not being fully read. I found out through further testing, that this process also fails
for TIFFs when the image is large, as the following error shows. So I think you are correct.
But I also checked the array lengths for my IO objects involved with the TIFF, and they are
all the same size as the byte[] from Sanselan... Bad Code: -1 codes: 258 code_size: 9, table: 4096
	at org.apache.sanselan.common.mylzw.MyLZWDecompressor.stringFromCode(
	at org.apache.sanselan.common.mylzw.MyLZWDecompressor.decompress(
	at org.apache.sanselan.formats.tiff.datareaders.DataReader.decompress(
	at org.apache.sanselan.formats.tiff.datareaders.DataReaderStrips.readImageData(
	at org.apache.sanselan.formats.tiff.TiffImageParser.getBufferedImage(
	at org.apache.sanselan.formats.tiff.TiffDirectory.getTiffImage(
	at org.apache.sanselan.formats.tiff.TiffImageParser.getBufferedImage(
	at org.apache.sanselan.Sanselan.getBufferedImage(
	at org.apache.sanselan.Sanselan.getBufferedImage(
	at org.apache.sanselan.Sanselan.getBufferedImage(

This is how I use Sanselan's function that takes the correctly created ByteArrayInputStream:

final BufferedImage image = Sanselan.getBufferedImage((InputStream) contents.getTransferData(dataFlavor));

Is it possible that this could be an issue with Sanselan?


> Two issues with BMPs.
> ---------------------
>                 Key: SANSELAN-14
>                 URL:
>             Project: Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Mac, Linux, Sanselan 0.94
>            Reporter: Kevin Theisen
>            Priority: Minor
>         Attachments: SanselanTest.bmp
> Hi all,
> Two things. The first is minor. There is a System.out.println() that should be commented
out in the BMP code. I see a lot of lines like this:
> "bits_per_sample: 8"
> The second is an error. When I create a BMP with Sanselan, everything works, and I can
load the output into OpenOffice without problem from the System Clipboard. However, when trying
to recreate the BufferedImage with Sanselan from the same exact output Sanselan created, I
get the following error:
> org.apache.sanselan.ImageReadException: BMP: Strange BitmapDataOffset: 266 (expected:
1078, PaletteLength: 1024, header_size: 54)
> 	at org.apache.sanselan.formats.bmp.BmpImageParser.readImageContents(
> 	at org.apache.sanselan.formats.bmp.BmpImageParser.getBufferedImage(
> 	at org.apache.sanselan.Sanselan.getBufferedImage(
> 	at org.apache.sanselan.Sanselan.getBufferedImage(
> 	at org.apache.sanselan.Sanselan.getBufferedImage(
> Let me know if you have any ideas about that.
> Thanks,
> Kevin

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message