假設有一Bitmap物件
Dim mybmp as new Bitmap( pic1.Image) '圖片大小640*480
Dim mycolor(640,480) as Color
Dim x,y as Integer
for x=0 to 480
for y=0 to 640
mycolor(x,y)=mybmp.Getpixel(x,y) '<---------------------取出顏色值
next y
next x
感覺在VB6時代用GetPixel的速度還算很快,但到了.NET速度變慢許多,還是有其他方式
可以快速的分離出圖片中的RGB值的方式?
獲取載入圖形大小的方法。
哈,因為學藝不精,只會套用。
Public Function GetPictureBoxZoomSize(ByVal p_PictureBox As PictureBox) As Rectangle
If p_PictureBox IsNot Nothing Then
Dim _ImageRectanglePropert As System.Reflection.PropertyInfo = p_PictureBox.GetType.GetProperty("ImageRectangle", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic)
Return DirectCast(_ImageRectanglePropert.GetValue(p_PictureBox, Nothing), Rectangle)
End If
End Function
---------------------------------------------------------------------- |