c# 4.0 - C# winform picturebox image lost after saving data -
i have winform application in there picturebox displays pretty big image (2550by4500). bitmap image transformed byte array using unsafe pointer, this:
bitmap img; unsafe { fixed (byte* intptr = &outbuffer[0]) img = new bitmap(_width, _height, _width * 3, system.drawing.imaging.pixelformat.format24bpprgb, new intptr(intptr)); }
so far, no problems. after displaying image, saved pixel values matlab .mat file using dll (http://www.mathworks.com/matlabcentral/fileexchange/16319). still, no problem saving.
however, image in picturebox became noisy black-white image, original image lost.
things tried:
- added bitmap in watch window, found out pixel values changed. bitmap corrupted.
- do unsafe transformation again everytime after saving, however, brings problem: "accessviolationexception in drawing.dll".
something must have .mat saving part, because if skip saving, no problem @ all. not know how related, memory? tried smaller size image, no problem. i'm assuming "save .mat" process corrupted bitmap?
any idea helpful! thank you
Comments
Post a Comment