 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Calimaw
Joined: 25 Aug 2006 Posts: 128 Location: Iowa, USA
|
Posted: Fri Dec 14, 2007 6:23 am Post subject: Bitmap to Text (Hex to Binary?) |
|
|
I'm playing around in GMod for HL2, and have been using a mod for it called WireMOD.
There is a digital screen in this game that has I/O capabilities, and it has it's own memory, which you can assign to it through a meriad of other I/O devices provided by this WireMOD addon.
What I'm trying to do is create a bitmap outside of game, using MSPaint or any other paint program of your choice, and to convert this 32x32 bitmap into a special format in a .txt file.
The way the format should be written is from left to right, going down (just like western reading/writing).
The color format is in 6 digits, the first 3 high digits are for RGB, the second 3 low digits are for saturation.
RGB has a range of 0 to 9 per value (009 is pure blue, 999 would be white).
Saturation has a range of 0 to 255 (009127 would be a grey-blue, 000255 would be white, as 999000 is white).
To get to the point, I need to convert Bitmaps to Text.
I would appriciate a starting refference if possible. I know theres probably some information on this some where, but I'm not able to find exactly what Im looking for. _________________ 83% Noob, 17% Coached...
Put on your smart face, that one is getting old and tired... |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1205 Location: USA
|
Posted: Fri Dec 14, 2007 6:40 am Post subject: |
|
|
post an example txt file and picture. _________________
 |
|
| Back to top |
|
 |
Calimaw
Joined: 25 Aug 2006 Posts: 128 Location: Iowa, USA
|
Posted: Fri Dec 14, 2007 6:52 am Post subject: |
|
|
Will do.
Will edit this post after manual conversion and post the image with the text.
EDIT:
This is the format.
| Code: |
0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0;
0,0;
0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0;
0,0;
0,0,900000,900000,900000,900000,900000,900000,900000,900000;
900000,900000,900000,900000,900000,900000,900000,900000,900000,900000;
900000,900000,900000,900000,900000,900000,900000,900000,900000,900000;
0,0;
0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0;
0,0;
0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0;
0,0;
|
Ignore any line seperations, it's for you to visually make more sense of it.
If you notice that each 'block' consists of 32 integers seperated by a comma, this is a ROW on X. so X0, X1, X2, X3 and so forth.
Each row has 32 values, each value is Y.
So the first row is
X0&Y0,X0&Y1,X0&Y2
the next row would be
X1&Y0,X1&Y1,X1&Y2
LEFT to RIGHT, TOP to BOTTOM.
I only did the first few rows, I stopped just before I did the text in the image.
PS: the colors used in this are Black, White, Red, Blue (as you can see)
In order of above, the values would be
0, 999000, 900000, 9000
OR
0, 255, 900000, 9000
White can be 255 because 000 RGB with 255 saturation is white as well, while 000255 is 255.
PPS: I did each block with no more than 10 values in length, that means a block will never be more than 4 rows.
Semi-colon ( ; ) is just a continuation of the block.
Sorry for the butt ASCII image above  _________________ 83% Noob, 17% Coached...
Put on your smart face, that one is getting old and tired... |
|
| Back to top |
|
 |
Calimaw
Joined: 25 Aug 2006 Posts: 128 Location: Iowa, USA
|
Posted: Fri Dec 14, 2007 6:09 pm Post subject: |
|
|
Perhaps I should ask how I can get the values of bitmap into text first. _________________ 83% Noob, 17% Coached...
Put on your smart face, that one is getting old and tired... |
|
| Back to top |
|
 |
Calimaw
Joined: 25 Aug 2006 Posts: 128 Location: Iowa, USA
|
Posted: Sat Dec 15, 2007 3:14 am Post subject: |
|
|
Any one done anything like this before? Or any information on atleast getting the HEX of a bit map to the point of editing it?
would be appriciated. _________________ 83% Noob, 17% Coached...
Put on your smart face, that one is getting old and tired... |
|
| Back to top |
|
 |
DerRaphael
Joined: 23 Nov 2007 Posts: 456 Location: Heidelberg, Germany
|
Posted: Sat Dec 15, 2007 3:29 am Post subject: |
|
|
i have writte a php function to dump me a colortable and a bitmap as indexed values to some sort of readable text code - if you want, i can send this to ya, probably you might be abled to convert it to ahk using some sort of pixelsearch or color at position function (if it exists - i have no clue)
more generic 'd be to use the gdi functions for reading a bitmap, msdn might be a helping hand in here
when you're reading a bitmap, you have the informations provided from gdi about the colortable used and where its stored and such stuff. so this 'd be a solution, too
sorry for not presenting any code, but i hope i could help you with at leat pointing to the direction
greets
derRaphael |
|
| Back to top |
|
 |
Calimaw
Joined: 25 Aug 2006 Posts: 128 Location: Iowa, USA
|
Posted: Sat Dec 15, 2007 3:45 am Post subject: |
|
|
Well I dont really need to get the X Y value of where a color is stored, but I do need to know it.
The color alone is all I need, and for the sequence to be left to right, top to bottom.
with the value range being 0 to 9 for R or G or B, and saturation to be from 0 to 255 _________________ 83% Noob, 17% Coached...
Put on your smart face, that one is getting old and tired... |
|
| Back to top |
|
 |
DerRaphael
Joined: 23 Nov 2007 Posts: 456 Location: Heidelberg, Germany
|
Posted: Sat Dec 15, 2007 3:50 am Post subject: |
|
|
PixelGetColor, OutputVar, X, Y [, Alt|Slow|RGB]
does this one help you? |
|
| Back to top |
|
 |
Z Gecko Guest
|
Posted: Sat Dec 15, 2007 3:52 am Post subject: |
|
|
I would suggest a quick and dirty solution:
First create a simple GUI showing the bitmap you would like to convert.
Then use PixelGetColor in a loop to retrieve the RGB values.
Convert them and store them in a text file. |
|
| Back to top |
|
 |
Calimaw
Joined: 25 Aug 2006 Posts: 128 Location: Iowa, USA
|
Posted: Sat Dec 15, 2007 3:55 am Post subject: |
|
|
thats just evil.
Im going to do some more searching, theres got to be a way of simply getting the information of a bitmap in HEX, and then I can convert from that. _________________ 83% Noob, 17% Coached...
Put on your smart face, that one is getting old and tired... |
|
| Back to top |
|
 |
Z Gecko Guest
|
Posted: Sat Dec 15, 2007 3:58 am Post subject: |
|
|
PixelGetColor will give you the hex-value of the color.
| Quote: | | The name of the variable in which to store the color ID in hexadecimal blue-green-red (BGR) format. For example, the color purple is defined 0x800080 because it has an intensity of 80 for its blue and red components but an intensity of 00 for its green component. |
|
|
| Back to top |
|
 |
Calimaw
Joined: 25 Aug 2006 Posts: 128 Location: Iowa, USA
|
Posted: Sat Dec 15, 2007 4:58 am Post subject: |
|
|
But I believe this searches for a pixel on the screen, Im more interested in something that doesnt require you to have the image on a gui.
I should have said this before, but what I want to do is navigate to a bitmap, and then convert it to a .txt file in the explained format.
The GUI would be very minimal, again I appologise for not stating this earlier, it fled my mind.
All in all, I dont want to SEE the image, ever, only point to the file, then convert. _________________ 83% Noob, 17% Coached...
Put on your smart face, that one is getting old and tired... |
|
| Back to top |
|
 |
DerRaphael
Joined: 23 Nov 2007 Posts: 456 Location: Heidelberg, Germany
|
Posted: Sat Dec 15, 2007 9:05 pm Post subject: |
|
|
ok, since you dont want to show the image used, just point at it and tell the scrit to convert, you will have to use a lot of dllcalls
MSDN Bitmaps overview
MSDN GetDIBits
in the forum is a function writte by philho who managed to load a bitmap and attach it a binary data - i know you dont need such - but he makes use of the mentioned gdi calls - probably you might adapt his source or get hints out of it on how to accomplish such a task.
the number converting will be a problem though. i have the feeling that this might be a somewhat modified HSB color model but somehow with merged H & B - dont know hot to accomplish this one. im sure there might be explanation of how to do this and even dummy explained versions like for me - but this is definitly outta my reach for now
so long
derRaphael |
|
| Back to top |
|
 |
cy3 Guest
|
Posted: Sat Jul 19, 2008 11:08 pm Post subject: |
|
|
| I don't think Wiremod can do file I/O... |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Jul 19, 2008 11:39 pm Post subject: |
|
|
search for a topic called findmatrix
there you would find a pixelsearch wich can be modified into the 32x32 matrix you want.
Every pixel has it own variable and can be changed too any format you like.
I use that script for aimbotting. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|