| View previous topic :: View next topic |
| Author |
Message |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Jun 28, 2009 10:33 am Post subject: Comparing bitmaps |
|
|
| Is there a function to compare 2 .bmps?
|
|
| Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Sun Jun 28, 2009 11:04 am Post subject: |
|
|
| I guess you could open both files and compare each byte..
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Jun 28, 2009 3:02 pm Post subject: |
|
|
1. The header will provide you with useful information, like the size, etc.
2. If that fails, the header also tells you where the actual pixel data is. Just compare the bytes.
|
|
| Back to top |
|
 |
Strider96 Master Cheater
Reputation: 1
Joined: 20 Jan 2008 Posts: 289 Location: [email protected]
|
Posted: Sun Jun 28, 2009 3:24 pm Post subject: Re: Comparing bitmaps |
|
|
| ; wrote: | | Is there a function to compare 2 .bmps? |
I don't get what you want but if you have windows 7 you can move one file to the far left and one to the far right and they go into compare mode or you can use areosnap:
http://aerosnap.de/download/aerosnap/current_version/aerosnap_0_61_setup.exe
_________________
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Sun Jun 28, 2009 4:08 pm Post subject: |
|
|
| Read the files into memory and then use memcmp(if you are using C++) to compare them.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Jun 28, 2009 4:15 pm Post subject: |
|
|
| Code: | #include <Windows.h>
struct BitmapInfo{
DWORD* rawStart;
DWORD* width;
DWORD* height;
BYTE* bits;
};
void LoadBMP(char* path, struct BitmapInfo* bmi){
DWORD bytesRead;
HANDLE hFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD bmSize = GetFileSize(hFile, NULL);
BYTE* bm = (BYTE*)HeapAlloc(GetProcessHeap(), 0, bmSize);
ReadFile(hFile, bm, bmSize, &bytesRead, NULL);
CloseHandle(hFile);
bmi->rawStart = (DWORD*)&bm[0x0A];
bmi->width = (DWORD*)&bm[0x12];
bmi->height = (DWORD*)&bm[0x16];
bmi->bits = &bm[*bmi->rawStart];
}
int main(void)
{
struct BitmapInfo bm1;
struct BitmapInfo bm2;
LoadBMP("C:\\bm1.bmp", &bm1);
LoadBMP("C:\\bm2.bmp", &bm2);
//example, bm1.bits points to the pixel data
//just compare them however you want. memcmp
return 0;
} |
I'm going out, I'm sure you can manage the rest. This should be more than enough to get you started
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Sun Jun 28, 2009 4:45 pm Post subject: |
|
|
| Oh gawd you're sexyyyy.
|
|
| Back to top |
|
 |
|