Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How do I convert longraw data in Oracle db to an image in Java?
Hello all,
How do I convert longraw field data (read initially from an image) in
Oracle database into an image in Java?
My setup is as follows: Windows NT station, Oracle Database containing
in one of its tables a longraw field. That field contains image pixels
(I've stored gif, jpeg and bmp images by reading the image file through
the DataInputStream class).
I'm developing a Java Applet that connects to the Oracle database
through the Thin Oracle JDBC drivers.
My question is, after retrieving the binary data from the longraw field
with the getBinary() method and placing it in a byte[] array in my
applet (for example: byte[] pixels = rset.getBytes(2), the longraw field
is the second field in the table), I'm having problems in converting the
pixels into an image using the MemoryImageSource class as follows:
Image picture = createImage(new MemoryImageSource(width,height,ColorModel.getRGBdefault(),pixels,0,width));
The image created by the latter command is not drawable from some reason.
Another issue is the differences between restoring gif and jpeg data versus bitmap data? What are the methods to get the bitmap pixels out of
gif or jpeg binary data?
Any ideas??
Thanks!
Amnon.
Received on Fri May 28 1999 - 03:51:14 CDT
![]() |
![]() |