Q> 60 * 66 PNG 이미지의 모든 RGB 픽셀 값을 표시하는 데 10-34 초가 소요되는 경우 이미지 뷰어에서 이미지를 즉시 보여주는 방법은 무엇입니까?이미지의 픽셀 값을 읽는 중
Dim clr As Integer ' or string
Dim xmax As Integer
Dim ymax As Integer
Dim x As Integer
Dim y As Integer
Dim bm As New Bitmap(dlgOpen.FileName)
xmax = bm.Width - 1
ymax = bm.Height - 1
For y = 0 To ymax
For x = 0 To xmax
With bm.GetPixel(x, y)
clr = .R & .G & .B
txtValue.AppendText(clr)
End With
Next x
Next y
편집
첫번째 코드 10초 및 AMD A6에 59 * 66 PNG 이미지에 대한 텍스트 박스의 모든 값을 나타내는 주변 34초 2를 얻어Dim bmp As New Bitmap(dlgOpen.FileName)
Dim rect As New Rectangle(0, 0, bmp.Width, bmp.Height)
Dim bmpData As System.Drawing.Imaging.BitmapData = bmp.LockBits(rect,Drawing.Imaging.ImageLockMode.ReadWrite, bmp.PixelFormat)
Dim ptr As IntPtr = bmpData.Scan0
Dim bytes As Integer = Math.Abs(bmpData.Stride) * bmp.Height
Dim rgbValues(bytes - 1) As Byte
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes)
For counter As Integer = 0 To rgbValues.Length - 1
txtValue.AppendText(rgbValues(counter))
Next
System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr, bytes)
bmp.UnlockBits(bmpData)
4GB RAM이있는 3500!
이미지의 크기는 얼마나됩니까? –
600 * 600 이미지의 경우 AMD A6에서 약 1 분 이상 소요됩니다! – Sourav