Pregunta

I am trying to get an bitmap of an image 1280 x 960 using c#. Instead of getting a single 1280 x 960 image, I get 3 replicate images 426 X 320 covering the top 1/3 of the 1280 x 960 area while the remainder 2/3 is black.

here is the uploaded image:

http://tinypic.com/r/538ltd/5

here is the code that I am using.

using System.Runtime.InteropServices;

byte[] frame;
//... code
frame = new byte[1280 * 960 * 3]; 

// code to get the frame

System.Runtime.InteropServices.GCHandle pinnedArray =   
      GCHandle.Alloc(frame, GCHandleType.Pinned);
IntPtr pointer = pinnedArray.AddrOfPinnedObject();

Bitmap bmp = new Bitmap(width, height, 3 * width, 
        PixelFormat.Format24bppRgb, pointer);

MemoryStream JPEGStream = new MemoryStream ();
bmp.Save(filepath, System.Drawing.Imaging.ImageFormat.Bmp);

I would like to get a single 1280 x 960 image covering the entire area.

¿Fue útil?

Solución

It was a intermittent hardware failure and now the issue is resolved.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top