Paint Bugs

Just had another silly bug. Was doing lazyfoo’s excellent SDL2 tutorials, since I figured I might as well start again from scratch for SDL2, because I’ll just breeze through the tutorials that don’t teach anything drastically new, and I might as well sharpen up. I decided that it would be more fun to manually create my own media assets (a fancy way to say pictures) for the tutorials.
On tutorial 3, a dead simple program is created to display an image that tells the user to X out of the window (hit the x button at the top of the program). When the user does this, the program closes. I had this bug and quickly, thanks to error checking, tracked it down to a bug in my LoadMedia(SDL_Surface** ppTemp) function. I realized that I had accidentally saved my intended image: this :


Originally saved as .png. Had issues when converting properly to .bmp.

, as a png. No problem, I still had it open in Paint and I just clicked Save As, and resaved it as a .bmp. I then changed the line of code from ‘file location’\\xButton.png, since I copied and pasted, to ‘file location’\\xButton.bmp.
The problem was, the program still didn’t work, and it failed in exactly the same place. I tried doing everything, and double checked everything. After a while I had a sneaking suspicion that maybe paint didn’t save my file properly, even though Windows showed it as being a 24 bit bmp. I created a new image:


Originally saved as a .bmp. That made a difference.

Looking in the file properties for both I noticed that the original image was 9.23 KB’s, whereas the newly saved (and properly saved) image was 900KB even. Considering the image is monochrome a .png is going to be much smaller, however a .bmp of the same resolution will be exactly the same size, due to the .bmp’s not being compressed. It’s pretty clear that Paint just didn’t properly save the image. It seems weird, but it’s possible that Paint can’t convert properly from .png to .bmp.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s