Bitmap problems

Discussion in 'Computer Science & Culture' started by Success_Machine, Jul 29, 2003.

Thread Status:
Not open for further replies.
  1. Success_Machine Impossible? I can do that Registered Senior Member

    Messages:
    365
    See the attached bitmap... there is something wrong with it. Perhaps it is missing information normally accessed with commands like BITMAPFILEHEADER or perhaps BITMAPINFOHEADER.... ??!?!

    Whatever it is, this image is impossible to process with raw code. The most upsetting thing is that I can view the image with MS Paint !!!! It's like my computer is dangling a delicious candyapple right in front of my face just out of arms reach.

    I can see it, but I can't program with it!!!! !!!!

    AAAAAAAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG!!!!!!!!!!!!!!!!!
     
    Last edited: Jul 29, 2003
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. okinrus Registered Senior Member

    Messages:
    2,669
    Probably the winapi functions for loading a bitmap would work.
    Try using LoadImage.
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. AntonK Technomage Registered Senior Member

    Messages:
    1,083
    I disagree. Never resort to the WinAPI unless you have to. That's not programming and more than turning your car on is being a mechanic or car designer. I am at work and as such do not have my hex editor to check out the file. However, I suggest you do just that and check http://www.wotsit.org/ which is a really good site for finding out the file format for various types of files. If that image does not adhere to the BMP standard, should be able to see why and probably write something to accomodate that.

    -AntonK
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. okinrus Registered Senior Member

    Messages:
    2,669
    Do whatever saves time because using BITMAPFILEHEADER is unportable anyways. If you are sure that the problem is in the bitmap file, then create a new bitmap file and paste the old one into it. After saving the new bitmap file, it should have the proper information. My bet is that your code for loading the bitmap is wrong or only works on a specific bitmap format.
     
  8. AntonK Technomage Registered Senior Member

    Messages:
    1,083
    Well okinrus may be right. Depends on your point to the project. If it just a programming project to load bitmaps for some purpose and you arne't doing it for money or anything such as that, then I would learn the formats and program them myself (whcih I have). Its a good feeling knowing its ALL your code. But then again if you are doing this as part of a larger proiject and this is just in your way. Use a graphics library (don't use the WinAPI there are more portable ways to load images). Check out DevIL. Its a good open source image library.

    -AntonK
     
  9. Success_Machine Impossible? I can do that Registered Senior Member

    Messages:
    365
    I got the BMP format description from wotsit.org. Then I downloaded Hackman hexadecimal editor freeware from download.com to check it out.

    I compared it with a BMP image that works and the result is: There's nothing obviously wrong with it!!!! @#$@

    It identifies itself as a BM.
    It gives the exact file size in bytes.
    It does everything else that the healthy BMP image does.

    But I can't process it. The AVI creator executable that I downloaded from AVI Tutor won't accept it. It gives some sort of "Runtime error 9 Subscript Out of Range" bullcrap. Even though it will accept other images just fine.

    I don't get it!
     
    Last edited: Jul 30, 2003
  10. Success_Machine Impossible? I can do that Registered Senior Member

    Messages:
    365
    Nevermind I solved the problem. Weeks ago I converted the bitmap to jpeg format to save disk space, then converted it back to bitmap format. Something was lost in the translation - still don't know what, but that's to be expected. Naturally it didn't work.

    So I've recreated original bitmaps, bitmaps that were never converted from their original format, and these bitmaps work.

    Thanks anyways for the help.
     
  11. AntonK Technomage Registered Senior Member

    Messages:
    1,083
    That means that whatever program you used to convert between BMP and JPEG wasn't adhering to the standards. Probably using MS code (since it works in MS Paint still).

    -AntonK
     
  12. Success_Machine Impossible? I can do that Registered Senior Member

    Messages:
    365
    I'll have to remember that too. I'd forgotten I'd done that and wasted two days trying to figure out why it didn't work! I used Polyview shareware to convert the images. Actually an extremely useful app, but I guess it's not perfect.
     
Thread Status:
Not open for further replies.

Share This Page