I have a byte
array that contains data for an image. The byte array is not read from an existing image file. The byte array is obtained by parsing a PDF file and reading an image embedded in it. I want to convert these bytes into an image and display it in a UIImageView
. I used the following code snippet. But the UIImage.LoadFromData
method returns null.
byte[] bytes = byteArray;
NSData nsdata = NSData.FromArray(bytes);
UIImage image = UIImage.LoadFromData(nsdata);
I was able to obtain a Bitmap from the same byte array and display it in Android. I know the following details about the image and bytes.
byte length: 14700 ( = 70 * 70 * 3)
image dimensions: 70 X 70
bits per component: 24 (3 bytes)
How can I create a valid UIImage from the byte array in iOS?