Re: byte[] to Image, HELP
From: Alex Molochnikov (NOBODY_at_NOSPAM.COM)
Date: 02/16/04
- Next message: dota: "Help needed on multiple filechooser, thanks!"
- Previous message: nos: "Re: Need help..."
- In reply to: Cyril Mrazek: "byte[] to Image, HELP"
- Next in thread: Cyril Mrazek: "Re: byte[] to Image, HELP"
- Reply: Cyril Mrazek: "Re: byte[] to Image, HELP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 16 Feb 2004 22:53:44 GMT
Image img = Toolkit.getDefaultToolkit().createImage(buf);
"Cyril Mrazek" <cyril.mrazek@bluewin.ch> wrote in message
news:fkg230trbaqjho87eh8suapa8hgoep0n99@4ax.com...
> Hello,
>
> I have a byte array, I get it from a Blob, such that if I write it
> into a FileOutputStream, I get a file on the disk:
>
>
>
> ... some SQL
> Blob blob = rs.getBlob(1);
> int c = (int)blob.length();
> byte[] buf = blob.getBytes(1, c);
> FileOutputStream fos = new FileOutputStream("sample.jpg");
> fos.write(buf, 0, c);
> ...
>
>
>
> and it works fine. Now I would like to generate an Image, or a
> BufferedImage, from that buffer and I can't find a way to do it. Any
> hint ?
>
> Thanks
>
> Cyril Mrazek
- Next message: dota: "Help needed on multiple filechooser, thanks!"
- Previous message: nos: "Re: Need help..."
- In reply to: Cyril Mrazek: "byte[] to Image, HELP"
- Next in thread: Cyril Mrazek: "Re: byte[] to Image, HELP"
- Reply: Cyril Mrazek: "Re: byte[] to Image, HELP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|