Page 1 of 1

Making .BMPs from PixelGetColor rectangle scans?

Posted: 20 Jul 2018, 19:24
by ahkwipper
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

Re: Making .BMPs from PixelGetColor rectangle scans?

Posted: 21 Jul 2018, 01:12
by Xtra
For 800 pixels is there any reason why you are not using: ImageSearch?
Checking 800 pixels is going to be really... slow.

Re: Making .BMPs from PixelGetColor rectangle scans?

Posted: 21 Jul 2018, 06:46
by ahkwipper
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.

Re: Making .BMPs from PixelGetColor rectangle scans?

Posted: 21 Jul 2018, 10:02
by trust_me
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