bmp files from input stream. Help Please.

Hello.

I'm using Jimi for workin with images.

When i load a bmp image by

Image image = Jimi.getImage(filename);

MediaTracker _tracker = new MediaTracker(this);

_tracker.addImage(image, 0);

try {

_tracker.waitForID(0);

}

catch (InterruptedException ex) {

System.out.println(ex);

}

_tracker.removeImage(image, 0);

it is working good, no problem.

but i need to get images from database as byte array, and i do:

Image image = Jimi.getImage(new ByteArrayInputStream(bytes));

MediaTracker _tracker = new MediaTracker(this);

_tracker.addImage(image, 0);

try {

_tracker.waitForID(0);

}

catch (InterruptedException ex) {

System.out.println(ex);

}

_tracker.removeImage(image, 0);

it is not working for bmp format, dimension for image = -1;

with other formats (jpeg, gif, tiff) is ok.

what is problem? help me please.

thank you very much.

[1005 byte] By [Ar@la] at [2007-10-3 4:50:33]
# 1

The first paragraph on [url=http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html]this page[/url] states that ImageIcon, which uses Toolkit methods in the background, will load jpg, gif and png images.

You can find the current image extensions supported by ImageIO readers in your docs guide: your_docs/guide/imageio/new_features.html or [url=http://java.sun.com/j2se/1.5.0/docs/guide/imageio/new_features.html]here[/url].

bmp and wbmp were added in j2se 1.5

Another option is JAI tools: [url=http://java.sun.com/products/java-media/jai/downloads/download-iio.html]JAI Image I/O API Download Page[/url].

74philipa at 2007-7-14 22:55:08 > top of Java-index,Security,Cryptography...