Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Comparing bitmaps

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Sun Jun 28, 2009 10:33 am    Post subject: Comparing bitmaps Reply with quote

Is there a function to compare 2 .bmps?
Back to top
View user's profile Send private message
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Sun Jun 28, 2009 11:04 am    Post subject: Reply with quote

I guess you could open both files and compare each byte..
Back to top
View user's profile Send private message Visit poster's website
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Jun 28, 2009 3:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
Strider96
Master Cheater
Reputation: 1

Joined: 20 Jan 2008
Posts: 289
Location: [email protected]

PostPosted: Sun Jun 28, 2009 3:24 pm    Post subject: Re: Comparing bitmaps Reply with quote

; 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

_________________
http://forum.cheatengine.org/viewtopic.php?t=473915

*These guys are awesome for doing this for me*

If I left you off I am sorry send me a PM and ill add you Smile
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sun Jun 28, 2009 4:08 pm    Post subject: Reply with quote

Read the files into memory and then use memcmp(if you are using C++) to compare them.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Jun 28, 2009 4:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Sun Jun 28, 2009 4:45 pm    Post subject: Reply with quote

Oh gawd you're sexyyyy.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites