gpt4 book ai didi

c# - 无法在C#中获得正确的位图1290 x 960图像?

转载 作者:行者123 更新时间:2023-12-02 16:41:33 24 4
gpt4 key购买 nike

我正在尝试使用C#获得1280 x 960图像的位图。我没有得到一张1280 x 960的图像,而是得到了3张复制图像426 X 320,它们覆盖了1280 x 960区域的顶部1/3,而其余的2/3是黑色。

这是上传的图片:

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

这是我正在使用的代码。

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);

我想要一张覆盖整个区域的1280 x 960图像。

最佳答案

这是间歇性的硬件故障,现在问题已解决。

关于c# - 无法在C#中获得正确的位图1290 x 960图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18516944/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com