Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.93 KB | None | 0 0
  1. #include <GDIPlus.au3>
  2.  
  3. $Path = "Path.jpg" ;Bildpfad
  4. ImagePixelToArray($Path)
  5.  
  6. Func ImagePixelToArray($Path)
  7.     _GDIPlus_Startup()
  8.     $hBitmap = _GDIPlus_BitmapCreateFromFile($Path)
  9.     $iX = _GDIPlus_ImageGetWidth($hBitmap)
  10.     $iY = _GDIPlus_ImageGetHeight($hBitmap)
  11.     ConsoleWrite("X:" & $iX & " - Y:" & $iY & @CRLF)
  12.  
  13.     Dim $Pixel[$iX][$iY]
  14.     For $i1 = 1 To $iX
  15.         For $i2 = 1 To $iY
  16.             $Pixel[$i1][$i2] = Hex(_GDIPlus_GetPixel($hBitmap, $i2, $i1))
  17.             ConsoleWrite("Color:" & Hex(_GDIPlus_GetPixel($hBitmap, $i2, $i1)) & @CRLF)
  18.         Next
  19.     Next
  20.     _GDIPlus_BitmapDispose($hBitmap)
  21.     _GDIPlus_Shutdown()
  22.     Return $Pixel
  23. EndFunc   ;==>ImagePixelToArray
  24.  
  25. Func _GDIPlus_GetPixel($hBitmap, $X, $Y)
  26.     ; Prog@ndy
  27.     Local $result = DllCall($ghGDIPDLL, "int", "GdipBitmapGetPixel", "ptr", $hBitmap, "int", $X, "int", $Y, "dword*", 0)
  28.     If @error Then Return SetError(1, 0, 0)
  29.     Return SetError($result[0], 1, $result[4])
  30. EndFunc   ;==>_GDIPlus_GetPixel
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement