Making .BMPs from PixelGetColor rectangle scans?

Get help with using AutoHotkey and its commands and hotkeys
ahkwipper
Posts: 10
Joined: 30 Jun 2018, 14:51

Making .BMPs from PixelGetColor rectangle scans?

20 Jul 2018, 19:24

Hi, I have a simple function to scan a rectangle of pixels on the active window, say its 20x40 pixels. So I push 800 hex numbers into an array in whatever order I like. Handy if I want to scan the same rectangle again a little later to see if the colors have changed significantly. But what I really want is to save them to disk as a .bmp file so I can look at the image later in a graphics program and give the file a meaningful name, eg wizard.bmp.

Then I could load it and other similar files on another day to compare with a new 20x40 rectangle from the screen to find if it's a wizard, or a goblin, or whatever.

How can I save these pixels to a .bmp file? And later, when I load the file, how can I access the data in the right order to compare the images?

I have a VisualBasic type program that can do this easily but it only works scanning its own windows, which is no use. I know I could just save the files as lists of pixels but then I couldn't easily determine what the pixels represent.

I'd be grateful for any help anyone could give me with this.

Steve
User avatar
Xtra
Posts: 1269
Joined: 02 Oct 2015, 12:15

Re: Making .BMPs from PixelGetColor rectangle scans?

21 Jul 2018, 01:12

For 800 pixels is there any reason why you are not using: ImageSearch?
Checking 800 pixels is going to be really... slow.
ahkwipper
Posts: 10
Joined: 30 Jun 2018, 14:51

Re: Making .BMPs from PixelGetColor rectangle scans?

21 Jul 2018, 06:46

It's not a picture I want to get it's just part of the window, which is probably one huge graphic. I haven't noticed that grabbing 800 pixels is all that slow.
trust_me
Posts: 60
Joined: 29 Jul 2017, 10:46

Re: Making .BMPs from PixelGetColor rectangle scans?

21 Jul 2018, 10:02

Xtra said it all ...it is slow using pixelgetcolor! You could get the screen area using gdip ,save it to bmp if needed .If you want to search the pixel values search for "lockbits" on this forum.

https://autohotkey.com/board/topic/9142 ... of-screen/

gdip lbrary
https://autohotkey.com/boards/viewtopic.php?t=6517

to get hex values out of bitmap
https://autohotkey.com/boards/viewtopic.php?t=35888

Return to “Ask For Help”

Who is online

Users browsing this forum: MrRED, swagfag and 41 guests