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 04:50:44 GMT


Kevin Theisen commented on SANSELAN-14:

Hi Charles,

Thanks for the quick response. The error only occurs when I'm interacting with the system
clipboard, not when I'm saving and loading actual files. All other image formats that are
written/read by Sanselan seem to work perfectly using identical code with the system clipboard,
and other programs can load the BMPs that Sanselan produces, it just can't read its own output
from an InputStream. The code I use is simply a call to Sanselan.getBufferedImage(InputStream)
function using an InputStream from the system clipboard:

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

The InputStream is generated with a single call to the Sanselan.writeImageToBytes() function,
followed by writing the bytes to an OutputStream. "bi" is the BufferedImage.

final ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
							ImageFormat.IMAGE_FORMAT_BMP, null));
	final ByteArrayInputStream stream = new ByteArrayInputStream(
	return stream;

I have tested this on Windows, Mac and Linux with the same resulting error. Sanselan PNG,
GIF, PPM and TIFF work without error with identical code (except for the ImageFormat constant
of course).

Sorry that I can't provide a concrete example.


> 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
> 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