Hello Guys ,
So i tried to run this game in xamarin forms ,
but when i try compile : System.Drawing.Bitmap mybitmap = new System.Drawing.Bitmap(img2); it raise that exception does anyone know what is the problem ?

Hello Guys ,
So i tried to run this game in xamarin forms ,
but when i try compile : System.Drawing.Bitmap mybitmap = new System.Drawing.Bitmap(img2); it raise that exception does anyone know what is the problem ?

The docs say that the value you're passing is is either not a valid image format or null. So what type of image is image? Why are you typecasting it to a byte array earlier in the code?
That is just a placeholder type. You need to actually look at what is being passed in. It must be a byte array that contains a valid image otherwise you cannot convert it.
//Will fail
TakePhoto(10);
//Will work
TakePhoto(Image.FromFIle(""));
//Will only work if array came from an image
TakePhoto(imageArray);
You can do typechecking to some degree but there is no way to confirm a byte[] is an image without trying to convert.
if (image is byte[] arr)
//try to convert to image
Okay So if the image is byte[] arr how can i convert it to system.drawing.Image ?
9 people are following this question.