mlodziaszka
mlodziaszka

Reputation: 129

Reading colour value from png file in C

I have to load colours value from *.png file in c. Something like imread in matlab. I learned png file construction, tried to open file as binary and write to matrix, but I probably done something wrong. I alao tried to search, but I couldn't find suitable library.

Any advice how can I do that or which library should I use?

Upvotes: 2

Views: 563

Answers (1)

greg
greg

Reputation: 4953

You're going to need to decompress the zlib compression on the PNG first (if there is any) before you can get to the raw color values. The easiest way to do this is through the free libpng. You will find many examples here and elsewhere on how to do just that.

Upvotes: 4

Related Questions