Guest Posted November 17, 2013 Share Posted November 17, 2013 hello, i have a test script that lists all the colors of each pixel in the some image. this is the script: expandcollapse popup#include <Array.au3> #include <GDIPlus.au3> _GDIPlus_Startup() $ImageFile = @ScriptDir&"\1.bmp" $AccuracyLevel = 10 ReturnArrayLetter($ImageFile,$AccuracyLevel) Func ReturnArrayLetter($ImageFile,$AccuracyLevel) Local $Xsize , $Ysize , $hImage , $aOutput = "" $hImage = _GDIPlus_ImageLoadFromFile($ImageFile) $Xsize = _GDIPlus_ImageGetWidth($hImage) $Ysize = _GDIPlus_ImageGetHeight($hImage) ConsoleWrite("$Xsize = "&$Xsize&" , $Ysize = "&$Ysize&@CRLF) For $x = 1 To $Xsize For $y = 1 To $Ysize $PixelColor = _GDIPlus_BitmapGetPixel($hImage, $x, $y) ConsoleWrite($x&"x"&$y&": "&$PixelColor&@CRLF) ;Sleep(10) Next Next _GDIPlus_ImageDispose ($hImage) Return $aOutput EndFunc Func _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) Local $tArgb, $pArgb, $aRet , $Output = -1 $tArgb = DllStructCreate("dword Argb") $pArgb = DllStructGetPtr($tArgb) $aRet = DllCall($ghGDIPDll, "int", "GdipBitmapGetPixel", "hwnd", $hBitmap, "int", $iX, "int", $iY, "ptr", $pArgb) $Output = "0x"&Hex(DllStructGetData($tArgb, "Argb"), 6) _GDIPlus_ImageDispose($Output) Return $Output EndFunc the problem is that when i run this, i get this Error crash: this is the full error: Problem signature: Problem Event Name: APPCRASH Application Name: autoit3.exe Application Version: 3.3.8.1 Application Timestamp: 4f25baec Fault Module Name: kernel32.dll Fault Module Version: 6.1.7601.18015 Fault Module Timestamp: 50b83c89 Exception Code: c0000005 Exception Offset: 00011389 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1037 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\System32\en-USerofflps.txt i don't know why is this happening .. This should finish through all image ...Please help me.I I've attached a file that contains the script + image: problem.7z thanks for helpers! Link to comment Share on other sites More sharing options...
l3ill Posted November 17, 2013 Share Posted November 17, 2013 Hi Gil900, If you run it in beta you get a Double Function name error. Rename your Function and it runs fine. Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Guest Posted November 17, 2013 Share Posted November 17, 2013 thanks. is there a AutoIt3Wrapper parameter for running the script with the beta version? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 17, 2013 Moderators Share Posted November 17, 2013 gil900,Just press Alt-F5 to run a script with the Beta. Or add the following directive: "#AutoIt3Wrapper_Version= ;(B/P) Use Beta or Production for AutoIt3 and Aut2Exe. Default is P"M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Developers Jos Posted November 17, 2013 Developers Share Posted November 17, 2013 Sometimes wonder why we bother maintaining a Helpfile. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Guest Posted November 17, 2013 Share Posted November 17, 2013 (edited) gil900, Just press Alt-F5 to run a script with the Beta. Or add the following directive: "#AutoIt3Wrapper_Version= ;(B/P) Use Beta or Production for AutoIt3 and Aut2Exe. Default is P" M23 thanks but this solution does not make my script work as billo. i don't get the error Double Function name... Edited November 17, 2013 by Guest Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 17, 2013 Moderators Share Posted November 17, 2013 (edited) gil900,You do have the Beta installed? M23>Running AU3Check (3.3.9.22) from:M:\Program\AutoIt3\Beta "M:\Program\Au3 Scripts\fred1.au3"(29,49) : error: _GDIPlus_BitmapGetPixel() already defined. Func _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ M:\Program\Au3 Scripts\fred1.au3 - 1 error(s), 0 warning(s) !>20:32:48 AU3Check ended. Press F4 to jump to next error.rc:2 Edited November 17, 2013 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
l3ill Posted November 17, 2013 Share Posted November 17, 2013 I assumed you had to be running the beta version as the _GDIPlus_Image is not in the stable release Help File... My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
guinness Posted November 17, 2013 Share Posted November 17, 2013 Sometimes wonder why we bother maintaining a Helpfile. Same here. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
UEZ Posted November 17, 2013 Share Posted November 17, 2013 (edited) Your function _GDIPlus_BitmapGetPixel() is not correct -> _GDIPlus_ImageDispose($Output) makes no sense (this cause the crash)! Use this instead: Func _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapGetPixel", "handle", $hBitmap, "int", $iX, "int", $iY, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) $GDIP_STATUS = $aResult[0] Return $aResult[4] EndFunc ;==>_GDIPlus_BitmapGetPixel It will return an integer with the ARGB color value. Br, UEZ Edited November 17, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Guest Posted November 17, 2013 Share Posted November 17, 2013 Your function _GDIPlus_BitmapGetPixel() is not correct -> _GDIPlus_ImageDispose($Output) makes no sense (this cause the crash)! Use this instead: Func _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapGetPixel", "handle", $hBitmap, "int", $iX, "int", $iY, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) $GDIP_STATUS = $aResult[0] Return $aResult[4] EndFunc ;==>_GDIPlus_BitmapGetPixel It will return an integer with the ARGB color value. Br, UEZ Thank you!This solution to the problem ..I just found this function(_GDIPlus_BitmapGetPixel) and then I edited this function ..I do not know what function _GDIPlus_ImageDispose() does. Originally, this function was outside the _GDIPlus_BitmapGetPixel function and i thought it will look better and will work the same when it is in a function ..It turns out I was wrong ..Do you know what this function does?I do not know why this function was included in the code.It also works without this function .. Link to comment Share on other sites More sharing options...
UEZ Posted November 17, 2013 Share Posted November 17, 2013 (edited) It releases the image handle (object). In your function you tried to release a pseudo image handle somewhere in the memory and that is the reason why you got the app crash (access violation)! Br, UEZ Edited November 17, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Guest Posted November 17, 2013 Share Posted November 17, 2013 (edited) Can you help me how to convert this variable: $Image[$y][$x] to a new $hImage variable? this is how the $Image[$y][$x] variable will look: col 0 col 1 col 2 col 3 col4 .... 0x00000|0x00000|0x00000|0x00000 ..... 0x00000|0x00000|0x00000|0x00000 ..... 0x00000|0x00000|0x00000|0x00000 ..... 0x00000|0x00000|0x00000|0x00000 ..... 0x00000|0x00000|0x00000|0x00000 ..... ....... ....... i know how to create variable but i don't know how to convert it back to $hImage variable that supported by GDI+ Edited November 17, 2013 by Guest Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2013 Share Posted November 18, 2013 (edited) here is a picture from the variable: i need to convert it to image.. the goal is to work on the image through Array and then convert it to $hImage Edited November 18, 2013 by Guest Link to comment Share on other sites More sharing options...
UEZ Posted November 18, 2013 Share Posted November 18, 2013 (edited) Here a way (needs latest beta and untested): $iH = UBound($Image) - 1 $iW = UBound($Image, 2) - 1 $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) For $y = 0 To $iH ;slower version For $x = 0 To $iW _GDIPlus_BitmapSetPixel($hImage, $x, $y, $Image[$y][$x]) Next NextEdit: code corrected because _GDIPlus_BitmapSetPixel writes directly to the bitmap.Br,UEZ Edited November 18, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now