Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working with PNG Format

Tags:

c++

c#

bitmap

png

I am looking to work with PNG format inside of either C++ or C#. I can't find any documentation on how to convert a PNG into a 2D array of bytes/floats which represent the colors on the image.

What I want to achieve:

  • Load Png to array [Width*Height]
  • Use PNG as a texture inside of a game

If someone could supply me with any documentation, source code or a C#/C++ library/dll that would be great.

Preferrably as C++ and without using any Windows specific library.

like image 426
Haydn Trigg Avatar asked Mar 08 '13 12:03

Haydn Trigg


1 Answers

Use libpng, the official PNG library.

Specifically, this page has all of the information on how to open and read.

like image 67
David Pfeffer Avatar answered Oct 12 '22 22:10

David Pfeffer