c# - Save Image File for Thermal Camera -


i have inherited code thermal camera , code demo application. need able save images camera takes can analysis on it. far code opens window preview cameras video.

// bitmap , thermography image. binary image buffer set 0(null) because not going use seekret = seekware_getimage(mhandle, intptr.zero, thermimagehandle.addrofpinnedobject(), displaybufferhandle.addrofpinnedobject()); if (seekret == swreturncode.none) {     // create bitmap rgba data     bitmap = new bitmap(imagewidth, imageheight, pixelformat.format32bppargb);      bitmapdata bmdata = bitmap.lockbits(new rectangle(0, 0, bitmap.width, bitmap.height), imagelockmode.writeonly, bitmap.pixelformat);     intptr pnative = bmdata.scan0;     marshal.copy(displaybuffer, 0, pnative, (bitmap.width * bitmap.height * 4));     bitmap.unlockbits(bmdata);  } 

in function have tried add following line

// added following  bitmap.save("c:\\tester\\my_image.jpeg",system.drawing.imaging.imageformat.jpeg); 

if has ideas on how should write eliminate error: an unhandled exception of type 'system.runtime.interopservices.externalexception' occurred in system.drawing.dll awsome, need figure out research.


Comments