views:

442

answers:

4

That there is no simple way to read a PNG file into a memory bitmap in native Windows seemed impossible, but after much googling I'm beginning to believe it. The libpng/zlib combination is just too big. Any third-party libraries Win32 libraries out there for reading a PNG?

Edit: The boost::gil::png solution is much more complex than I'd hoped, too. Just need a single call that takes a file name and fills a memory buffer with pixels.

+1  A: 

libgd is an excellent library that can be used in Windows and has bindings for many popular languages.

Greg Hewgill
A: 

There is some built-in stuff you can use: IImgCtx and on later versions of windows you also have WIC

Anders
+6  A: 

Or of course you could use GDI+ - The Bitmap object takes a string constructor and loads the specified file into memory. That way you dont' need any external libraries, just that which comes with windows.

Larry Osterman
That is what I am looking for, thanks. I (mistakenly) thought that GDI+ was part of .NET, and the .NET runtime didn't go out with Windows XP and SP2. This is great news.
I. J. Kennedy
Nah GDI+ is a part of core Windows.
Larry Osterman
A: 

I have successfully used libpng to do this.

Adam Pierce