I am reading a raw image from the web. This image was read by an image sensor, not from a file.
This is what I know about the image:
~ Height and Width
~ Total size (in bytes)
~ 8-bit grayscale
~ 1 byte / pixel
I am trying to convert this image to a bitmap in order to display it in the image.
Here is what I tried:
BitmapFactory.Options opt = new BitmapFactory.Options(); opt.outHeight = shortHeight;
decodeByteArray returns null since it cannot decode my image.
I also tried reading it directly from the input stream without first translating it into a byte array:
imageBitmap = BitmapFactory.decodeStream(imageInputStream, null, opt);
This returns null .
I searched this and other forums, but cannot find a way to achieve this.
Any ideas?
EDIT: I have to add that the first thing I did was check if the stream really contains the original image. I did this using other `apps (iPhone / Windows MFC) and they can read it and display it correctly. I just need to figure out a way to do this in Java / Android.
source share