incubator-sanselan-dev mailing list archives

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


Charles Matthew Chen commented on SANSELAN-14:

Okay Kevin, this is definitely getting more clear.

My first thought is - are you sure you are reading the BMP completely from the Inputstream?[], ...) won't necessarily read the entire stream - you have to read
until EOF, ie. when .read() returns < 1 byte read.  

That would explain why the image can be read from a file, but not from the byte array/stream.
 Or perhaps the same problem is occurring on the write side - that a buffer isn't flushed
or something.  I assume either your code or Sanselan is using a ByteArrayOutputStream and
calling getBytes() after the image is written to the stream.

This is easy to check - the sample image you've attached is 1666 bytes.  Is the byte array
the same size?  If so, I'm barking up the wrong tree.

> 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