Belfigor Posted April 13, 2008 Share Posted April 13, 2008 (edited) For example i have a pixel that can change its color in a huge color range. And i need to do some action when that pixel gets any color of gradient from black to white. Is it possible to use ane PixelGetColor or PixelSearch commands? Can u show me how to use them when i need to search for color range in 1 pixel Edited April 13, 2008 by Belfigor [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
ProgAndy Posted April 13, 2008 Share Posted April 13, 2008 Create an Array with all possible Clors and the do $isinColorrange = ArraySearch($colors,PixelGetColor(x,y)) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Belfigor Posted April 13, 2008 Author Share Posted April 13, 2008 Create an Array with all possible Clors and the do$isinColorrange = ArraySearch($colors,PixelGetColor(x,y))And how to create an Array? Im very new in AutoIt [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
ProgAndy Posted April 13, 2008 Share Posted April 13, 2008 Dim $Array[ NumberOfEntries ] = {Entry1,Entry2,...} Or Dim $Array[ NumberOfEntries ] $array[0] = Entry 1 $array[1] = Entry 2 _ArraySearch is in the include Array.au3 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Belfigor Posted April 13, 2008 Author Share Posted April 13, 2008 Dim $Array[ NumberOfEntries ] = {Entry1,Entry2,...} Or Dim $Array[ NumberOfEntries ] $array[0] = Entry 1 $array[1] = Entry 2 _ArraySearch is in the include Array.au3Big thx, will test it when will come home. [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
Belfigor Posted April 13, 2008 Author Share Posted April 13, 2008 (edited) Big thx, will test it when will come home.Its impossible to set an array for all colors that are between white and black. there are thousands of colors. Is there another way to search a pixel for a huge range of colors? May be something like:PixelSearch (1, 1, 3, 3, (0xFFFFFF - 0x000000))??? Edited April 13, 2008 by Belfigor [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
ProgAndy Posted April 13, 2008 Share Posted April 13, 2008 Maybe this way: $x = PixelSearch() $x = Hex($x,6) $r = Stringleft($x,2) $g = StringMid($x,3,2) $b = StringRight($x,2) If ($r = $g) and ($g = $B) Then ; Colors are gray, white or black. Endif This way you cant have Colors like 0xAAAAAB or ox000001 They must be oxFFFFFF or 0xDDDDDD or 0x111111 ... (Allcolors the syme value) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Belfigor Posted April 13, 2008 Author Share Posted April 13, 2008 Maybe this way:///Its a good idea but it will not work I need to search for any color from gradient on the picture. Is it possible? [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
Belfigor Posted April 14, 2008 Author Share Posted April 14, 2008 UP. Help please [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
LogicalAI Posted April 14, 2008 Share Posted April 14, 2008 (edited) What do you mean search for any color? Anything not greyscale? If that is the case you can pixel scan that entire line from left to right for example, and when a pixelgetcolor returns a decimal that is outside the whites range, exitloop. While 1 For $Line = 1 To 300 ;length of the scan line in pixels If PixelGetColor($InitialPosition + $Line, 345) < 14777215 Then ;you've hit the color range you are after ExitLoop ExitLoop EndIf Next Sleep(10) WEnd Edited April 14, 2008 by LogicalAI Link to comment Share on other sites More sharing options...
junkew Posted April 14, 2008 Share Posted April 14, 2008 I am not sure what your question means exactly but it looks likestudy pixelsearch in the helpstudy pixelgetcolor in the helpLook at thread http://www.autoitscript.com/forum/index.ph...mp;#entry4931371. Sample code to get all hex colors for a certain area$startX=46 $endX=48 $startY=3 $endY=8 for $x=$startX to $EndX for $y=$startY to $endY consolewrite(hex(pixelgetcolor($x,$y)) & ";") next consolewrite(@CRLF) next2. Check if a certain color is in a certain rangeif pixelGetColor($x,$y)>.... and pixelGetColor($x,$y)<....3. You only can get a color of a certain location and have to check yourself for the right colors including the gradientSearch in the forum as some solution(s) are there all based on basic commands like pixelgetcolor, pixelsearch, bitblt, getDIBits, reading the bytes of the colors into an array and checking yourself. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Belfigor Posted April 14, 2008 Author Share Posted April 14, 2008 Thank you every one [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] Link to comment Share on other sites More sharing options...
Belfigor Posted April 15, 2008 Author Share Posted April 15, 2008 Аnd where i can read some manuals for hex colors? How to make RGB => Hex? [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size] 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