Thread: comparing bitmaps

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    29

    Question comparing bitmaps

    Hi there,

    I would like to know how to read a bitmap file as input to a
    program. Can you for example use the string handling functions
    fgetc() and fgets() or would you use fread()?

    I need to be able to compare two bitmaps and return a bool result to indicate that they are identical or non-identical.

    In essence how would you go about comparing bitmaps ?
    would you be comparing the numerical data for each pixel,
    pixel by pixel ?

    Help ....,

    regards,

    bigSteve
    bigSteve

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    fread() is certainly more appropriate. a bmp is a big ol buffer of scanlines and it would be quite slow and foolish to read one byte at a time. That having been said, do you know the format of a DIB? if not, look up BITMAPFILEHEADER, BITMAPINFOHEADER, BITMAPINFO, RGBQUAD and RGBTRIPLE. Plus there is a big ol bunch of fun about padding scan lines to 4 byte boundaries. You'll like that.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing bitmaps efficiently
    By scwizzo in forum Windows Programming
    Replies: 28
    Last Post: 06-30-2009, 08:25 PM
  2. DX9 Not Displaying Bitmaps
    By Sentral in forum Game Programming
    Replies: 9
    Last Post: 01-31-2006, 05:35 AM
  3. MFC: Multiple clicks shows multiple bitmaps - how?
    By BrianK in forum Windows Programming
    Replies: 0
    Last Post: 06-20-2004, 07:25 PM
  4. using standard bitmaps in the toolbar editor
    By Kibble in forum Windows Programming
    Replies: 0
    Last Post: 12-23-2002, 08:43 PM
  5. comparing bitmaps
    By bigSteve in forum C++ Programming
    Replies: 3
    Last Post: 11-11-2002, 11:54 AM