I have a 400x300 PNG file that I would like to convert into a bitmap, to use with my C++ program. Are there any converters that will do this for me? Either online or for OS X?
Just about any image editor should be able to open it and save it as a bmp...
And if you're looking for scriptability, imagemagick and graphicsmagick have command-line tools and C (C++ ?) APIs Smile
merthsoft wrote:
Just about any image editor should be able to open it and save it as a bmp...


Oh, well, let me clarify...I have converted it to a bmp...doesn't suit my needs. I need the raw data of the file.
bitmap as-in the data from the PNG? Why not try using libpng?
Yes, AHelper. Where can I download it?
Wouldn't a request to pretty much any search engine lead you to http://www.libpng.org , or http://libpng.sourceforge.net/ ? Wink
Research is a valuable attribute to acquire Smile

I don't know much about using them, though.
ACagliano wrote:
Oh, well, let me clarify...I have converted it to a bmp...doesn't suit my needs. I need the raw data of the file.


bmp *is* the raw data of the image.
As Kllrnohj stated, (most) BMP files are just the raw data of the file. By most, I mean all bitmaps that you'll get out of an image editor. The specification technically could support some compression, but no one uses it. I personally use 24 bit bitmaps for everything. The format is simple enough, and I can whip up a quick parser to read them in to the format I desire. Although if you plan on using large images, and/or deploying this application to a large modding base, you should look in to using one of the many fine image libraries such as libpng.

To quote a wiki: "The API documentation is available with the source code distribution in files libpng.3, libpng.txt and example.c. These files explain the usage of libpng API. "
Lionel Debroux wrote:
Wouldn't a request to pretty much any search engine lead you to http://www.libpng.org , or http://libpng.sourceforge.net/ ? Wink
This. Google searching is quite the valuable tool. And yes, unless it's RLEd (Run-Length Encoded), the contents of a bitmap file are the raw bits of the image, laid end-to-end.
ACagliano wrote:
I have a 400x300 PNG file that I would like to convert into a bitmap, to use with my C++ program. Are there any converters that will do this for me? Either online or for OS X?


Gimp.app or Seashore.
KermMartian wrote:
This. Google searching is quite the valuable tool. And yes, unless it's RLEd (Run-Length Encoded), the contents of a bitmap file are the raw bits of the image, laid end-to-end.

Don't forget that they may be in bottom-to-top order (usual) or top-to-bottom (less common) so you may (or may not) need to flip them.

Much easier to just use an existing image loader, really. Smile
Also, if you simply want the raw RGB888 data from an image, open your image in Gimp, flatten the image, (delete the alpha if you don't want rgba8888), save as... -> raw data. It saves as headerless data in RGB888 format. I use it for images on the prizm.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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

 

Advertisement