Sounds simple right? Use
ImageIO.read(new ByteArrayInputStream(bytes));
Here\'s the wrinkle. For some reason it is detecting a jpeg as a b
Haven't played with ImageIO in a awhile, and have not tested this, but I seem to recall something like this working. (since you say you know your file is a jpg and not a bitmap, I am using that information to help find the right loader).
String inFormat = "jpg";
Iterator inReaders = ImageIO.getImageReadersByFormatName(inFormat);
...
nextInReader.setInput( iis );
For the reference you can have a look at wikipedia, you can find the header of the different formats there.
http://en.wikipedia.org/wiki/Graphics_Interchange_Format
http://en.wikipedia.org/wiki/BMP_file_format
http://en.wikipedia.org/wiki/JPEG
Is the BMP reader the only one returned by getImageReaders()
? Maybe you get more than one and can make a choice based on that.