在VB中将位图转换为RGB

时间:2012-02-18 00:51:54

标签: vb.net system.drawing

请参阅下面的附件代码。我已经设法使用VB截取我的计算屏幕截图,并将其存储为位图。我想将这个位图(快速!)转换为rgb值数组。

任何可以做到这一点的简单代码?

干杯 马丁

' Capture screen code
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)

' Display the captured image
 Display.Image = screenshot

1 个答案:

答案 0 :(得分:0)

一个例子是在Bitmap.LockBits文档中: http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx#Y856