开发者

C++ Convert Binary File to Image

I'm trying to make a C++ console app that can convert binary(m开发者_Go百科p3) files to images. How can I read every binary character in the file, convert to hex, and then save it as an image. Here is what I want but in C++


You might find this tutorial helpful:

http://www.cplusplus.com/doc/tutorial/files/ (Scroll down to the section binary files)

Also, let me share my standard recommended links for people asking for aid on basic c++:

Full scale tutorial on c++

C++ Language Reference (including STL)

ANSI C Language reference for all those pesky C stuff that C++ keeps using


  1. Create an image with an area big enough to fit the data in.
  2. For each byte in the source file, set a pixel. You could do this a number of ways - monochrome, or take bytes in threes and write them as red, green and blue for a 24-bit colour image.
  3. Save the image to disk, e.g. in PNG format using libpng.

If you want a more specific answer, you'll need to ask a more specific question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜