AutoHotkey Community

It is currently May 27th, 2012, 1:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: March 10th, 2009, 3:57 pm 
Offline

Joined: September 18th, 2008, 6:46 pm
Posts: 17
Location: Knoxville, TN
I'm looking for a program that will scan a picture and then go to paint and will then draw the picture identical to the scanned pic. Unfortunately I don't know how to start or where to begin. Please help me or at least help me get going in the right direction.. Thank you very very much!!!


Last edited by KnoxClippers on March 10th, 2009, 7:33 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 4:01 pm 
really? why?
there are much much easier ways to reproduce a picture.

but if you insist, you´ll need
PixelGetColor and MouseClick


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 4:20 pm 
Offline

Joined: September 18th, 2008, 6:46 pm
Posts: 17
Location: Knoxville, TN
its going to be used in a game... haha... and i can't use actual pics but u can draw some and i'm just trying to find an easy way to get pics that look real into the game!! Using PixelGetColor how can i get it to find and duplicate the whole area of the pic that is that color... I'm sry if i ask simple or basic ?'s i'm fairly new to all of this and don't have any experience in any other programming... Thank u all for all of ur help!!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 4:33 pm 
Quote:
Using PixelGetColor how can i get it to find and duplicate the whole area of the pic that is that color...
Not at all, PixelGetColor wil get you the color of a certain pixel. You need to loop the command, to get the colors of all pixel.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 5:43 pm 
Offline

Joined: March 4th, 2009, 4:15 pm
Posts: 7
getpixelcolor will work; but will be horribly slow. If it's a moving image I'd be doubtful such a loop would be able to capture the image you want since the screen would update before you caputre all the pixels. (if you were just capturing a subset of pixels then maybe it'd work)

Are you looking to capture the whole screen or just a portion of the screen?

Also is there a reason the screen capture built into the game / OS won't work?
Just emulate the "Print Screen" key; which should put a cpoy of the monitor image onto the clipboard (as a bitmap)... then goto MSPaint and "paste" the clipboard. This is going to be the easiest to implement solution and likely far better on performance (but I'm sure there's room for improvement).

If you're looking to capture only a portion of the screen there are other options / functions you could use... but again I'm sure most will suffer from the same side-effects as getpixelcolor.

Edit: re-reading your request it seems you want to take a picture and then transfer it into the game (I'm guessing as a texture on an object). If you've already scanned the image there are any number of ways to make the picture look like it was "drawn"; you'd be better off hitting up some image editing software (photoshop being a popular choice). If this is indeed your task editing software would make much more sense than autohotkey.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 5:54 pm 
Offline

Joined: September 18th, 2008, 6:46 pm
Posts: 17
Location: Knoxville, TN
i'm needing to go scan from mouse cords 45, 30 all the way to 260, 245... i know the script isn't going to cover the whole area as i have right now but i can try and figure that out in a min. But i just wanted to make sure i have the right idea and that i'm on the right track before i spend all day wasting my own time. haha... Thank u again for all ur time and help!

Code:
pixelnum = 1
mousex = 45
mousey = 30

^#c::
loop 10
{
PixelGetColor, color%pixelnum%, %mousex%, %mousey%
pixelnum++
mousex++
mousey++
}
msgbox, %color1%`n%color2%`n%color3%`n%color4%`n%color5%`n%color6%`n%color7%`n%color8%`n%color9%`n%color10%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 6:02 pm 
Offline

Joined: September 18th, 2008, 6:46 pm
Posts: 17
Location: Knoxville, TN
OK so basicly the game has a white board that u can draw on and customize and i'm just trying to get something that can draw a pic inside the game on that white board. Or if i can get it to trace the out line i can fill in manually!!. I don't even know if this is possible with autohotkey... Its just an idea i had.... Thanks!!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 6:23 pm 
Offline

Joined: March 4th, 2009, 4:15 pm
Posts: 7
what you have will work, if the part of the screen is stationary then you don't have to worry about the time (we're still talking in the order of <1sec; but when your monitor refreshes @60Hz 1 second means 60 different images).

But yes your code below will grab the pixels at the desingated area (you'll need 2 loops; one for X and 1 for Y... right now you're grabbign only the diagonal b/c you increment both X and Y in the same loop).

As for drawing in your game; I don't know what commands it has but I doubt it'll be so nice as to let you specify an exact color for an exact pixel.

Detecting "outlines" is serious work; and there's lots of different approaches on the matter. Your code below will basically give you a bitmap of all the pixels in the specified area; you'd then have to manipulate that structure somehow to get it "drawn" on your whiteboard, which is non-trivial.

For example you'd have to have some commands along these lines:
loop x
loop y
color := selectColor(x,y,source)
drawpixelingame(x,y,color)
y++
x++
end
(above is psuedocode)
select color would basically be done by getpixelcolor
drawpixelingame() function would have to tell the game you wanted to draw the particular color, then place that color at the appropriate x,y coordinate on the game's whiteboard (obvoiusly you'd have to use some offset for x&y so it appears in the right place).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2009, 7:22 pm 
Offline

Joined: September 18th, 2008, 6:46 pm
Posts: 17
Location: Knoxville, TN
ok so this is what i have so far...
Code:
^#c::
loop 215
{
loop 215
PixelGetColor, color%pixelnum%, %mousex%, %mousey%
pixelnum++
mousex++
}
mousey++
loop 215
{
PixelGetColor, color%pixelnum%, %mousex%, %mousey%
pixelnum++
mousex--
}
}


I believe this should cover the entire area... Now........ I have no clue on how to use these in the game! I think i am going to have to put these in a document and just read it line by line and group it by colors and make a script that will just do one color at a time?! and with the variable being color%pixelnum% what would be an easy way of using those without numbering each one!? I hope this makes sense because i'm starting little confused. haha Thank you again for everything!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, oldbrother, Yahoo [Bot] and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group