Haydn Trigg
Haydn Trigg

Reputation: 115

Working with PNG Format

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:

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.

Upvotes: 5

Views: 3272

Answers (3)

leonbloy
leonbloy

Reputation: 76016

In C, libpng is the canonical way. In C#, you can try PngCs.

Upvotes: 1

hyde
hyde

Reputation: 62908

For documentation on anything "standard" thing which is widely used, Wikipedia is usually the best first stop. From there you can either read the Wikipedia article, or skip right to External Links section.

For C# code, see for example: Reading a PNG image file in .Net 2.0 . As far as I can tell, it's old enough to be part of the ECMA-standardized version of C#, so should be available also on Mono.

Upvotes: 1

David Pfeffer
David Pfeffer

Reputation: 39872

Use libpng, the official PNG library.

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

Upvotes: 4

Related Questions