Hello, please I need your help. I'm trying to get X and Y of image on screen. I know, I must make screenshot and search image (I have image that I'm trying to get location in Resources), but I don't know, how to search it. Can anyone help me? Thanks advance
When you have the image, you need to get the size and then you can calculate the position you need.
When you have always the same imagesize, you could say the programm to choose a spezific area, but I don't recommend it.
Here is one fastly and not-tested code file:
First I dont remember is it (x,y) or (y,x). So thats might be the first one which causes problems
Code:
private function find_pixel (pic as bitmap, pic2 as bitmap) as string
pic = 'image where u want to search another picture'
pic2 = 'image you are finding from pic'
Dim pixelCol as color
for x = 0 to pic.width -1
for y=0 to pic.height -1
PixelCol = pic.getPixel(y,x) 'or (x,y) I dont remember..'
if PixelCol = pic2.getPixel(0,0) then 'first pixel is 100% same color'
'now depend on image size and what u want to do but there is one solution (to check whole image):'
for i=0 to pic2.width - 1
for j=0 to pic2.height -1
if pic.getPixel(y+j, x+i) = pic2.getPixel(i,j) then
'match -> lets check next pixel'
else
'not same image'
next y
exit for 'exit for j'
end if
Return y,x 'or (y+j, x+i) or what pixel u want? first is starting pixel and secong last pixel'
next j
next i
end if
next y
next x
end function
The above is ok for smaller images but its a bit slow. To do the same faster, take a look:
[C#] Position eines Image in Screen suchen 06/11/2013 - .NET Languages - 0 Replies Hallo,
ich suche eine Methode, die in einem Screenshot nach einem bestimmten Bild sucht, welches im Programm hinterlegt ist. Die Methode soll dann die Koordinaten ausgeben, wo sich das Template Image im Source Image befindet.
Natürlich hab ich versucht mich dazu schon etwas zu erkundigen und bin im Internet auf einen Code, basierend auf der AForge.net Libary, gestoßen, welcher jedoch bei mir nicht funktioniert und das Programm zum Absturz bringt:
System.Drawing.Bitmap sourceImage =...
Image on the screen 07/09/2012 - AutoIt - 2 Replies Hello ppls.
Is it possible,in autoit,to dont make anything only an transparent background image somewhere on the screen,like a "+" or something?? If yes,please,tell me how.
And to make the script to be ALWAYS ON TOP???
[VB.NET] Image From Screen? 03/20/2012 - .NET Languages - 2 Replies Hey,
Is there any understandable way to found image X from screen?
For example if I have set image X as elitepvpers logo. I come to this site and click "find" button -> msgbox("imagefound" + image.size + image.location....).
This above is the main question but if someone knows how to draw perfectly to screen it would be nice to know. I know how to draw dot, squares, etc but they stay on screen just until I draw other window above them. (=how to get them to stay on screen (topmost) even...
Dibiase - New Sig/Full Size Image - [GIANT IMAGE WARNING] 10/26/2011 - General Art - 1 Replies WARNING - SOME OF THESE IMAGES ARE MASSIVE(OVER 2000 PIXELS WIDE/1000 PIXELS HIGH).
This is my latest signature collection, the full size images show the detail.
Full-Size:
http://img339.imageshack.us/img339/971/dibiaseful l.png
Super-Sized:
[Request][Help] Moving clients to position on screen (right-top corner) 02/02/2010 - CO2 Programming - 1 Replies Just found an easy way to do this with autohotkey.
for who ever is interested the ahk script would be:
WinWait, Raiding Clans
WinMove, 0, 0 ;
For top left corner, for right top corner you have to look at what your resolution is to know where to put it.
EDIT://
Ok now, with the new chat in conquer i noticed moving my CO with this is not a correct way.