Re: creating an ImagePlus from an InputStream or a byte[]
Posted by
Johannes Hermen on
Dec 12, 2007; 2:35pm
URL: http://imagej.273.s1.nabble.com/creating-an-ImagePlus-from-an-InputStream-or-a-byte-tp3697788p3697792.html
ImageJ Interest Group <
[hidden email]> wrote on 12.12.2007 12:44:55:
> > Does anybody knows a solution on how to create an ImagePlus
> > directly from
> > a byte[] or an Inputstream.
> > The thing is that we want to show Images stored in a database blob
> > without
> > creating a tempfile before.
> >
> > It would be really nice to have something like this new ImagePlus
> > (byte[])
> > or new ImagePlus(InputStream)
> Hello Johannes
>
> Try this:
>
> InputStream myStream = ...;
> ObjectInputStream ois = new ObjectInputStream(myStream);
> ImagePlus ip = (ImagePlus) ois.readObject();
That would only work if the byte[] is a serialized ImagePlus, but our
byte[] is an gif/png/jpg/bmp etc...
-----------------------------------------------------------------
Johannes Hermen - Ingenieur de Recherche
[hidden email]
-----------------------------------------------------------------
CRP Henri Tudor
http://www.santec.tudor.lu29, Avenue John F. Kennedy
L-1855 Luxembourg
-----------------------------------------------------------------