Nebieboy Posted December 15, 2006 Share Posted December 15, 2006 is their a method to find a percent of pixels within an area? this would be extremly useful for reading health and other attributes on screen like process bar etc. like "pixelpercent(200,200,400,400, 0xFFFFFF)" then find use the total amount of pixels and do some basic math to work out how many are white?... does this exist? or is their a method anyone knows of? thanks in advance Link to comment Share on other sites More sharing options...
Kohr Posted December 15, 2006 Share Posted December 15, 2006 Try _PixelSearchAdvanced in my sig. Kohr AutoIt LinksAutoIt CrapsGrid_PixelSearchAdvancedPixelGrab Link to comment Share on other sites More sharing options...
mikehunt114 Posted December 15, 2006 Share Posted December 15, 2006 (edited) Func _PixelPercent($left, $top, $right, $bottom, $color) Local $count = 0, $percent = 0 For $i = $left to $right Step 1 For $j = $top to $bottom Step -1 $poscolor = PixelGetColor($i, $j) If $poscolor = $color Then $count +=1 Next Next $total = ($right - $left + 1) * ($top - $bottom + 1) $percent = Round($count/$total, 3) Return $percent EndFunc Only tested it a couple times. Like PixelSearch, it will be slow if the area is large, since it searches every pixel. Edited December 15, 2006 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Nebieboy Posted December 16, 2006 Author Share Posted December 16, 2006 ok thank you for your help guys 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