Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top