views:

29

answers:

1

I am trying to get the size of PNG image (Without storing into file). I am using this code as reference. When calling GetDIBits(), size of image would get updated into bi.biSizeImage. Everything works fine when bi.biCompression is BI_RGB. Then I have changed the compression mode from BI_RGB to BI_PNG; GetDIBits() started to fail. Please help me to solve this.

+2  A: 

According to http://msdn.microsoft.com/en-us/library/dd145023%28VS.85%29.aspx:

"This extension is not intended as a means to supply general JPEG and PNG decompression to applications, but rather to allow applications to send JPEG- and PNG-compressed images directly to printers having hardware support for JPEG and PNG images."

using GetDIBits() with BI_PNG is not allowed.

Cristian Adam