GetDIBits() 因 PNG 压缩而失败 [英] GetDIBits() is failing with PNG compression
问题描述
我正在尝试获取 PNG 图像的大小(不存储到文件中).我使用 此代码作为参考.当调用 GetDIBits()
时,图像的大小将更新为 bi.biSizeImage
.当 bi.biCompression
为 BI_RGB 时,一切正常.然后我将压缩模式从 BI_RGB 更改为 BI_PNG;GetDIBits()
开始失败.请帮我解决这个问题.
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.
推荐答案
根据 http://msdn.microsoft.com/en-us/library/dd145023%28VS.85%29.aspx:
此扩展并非旨在为应用程序提供一般的 JPEG 和 PNG 解压缩,而是允许应用程序将 JPEG 和 PNG 压缩图像直接发送到具有 JPEG 和 PNG 图像硬件支持的打印机."
"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."
不允许将 GetDIBits() 与 BI_PNG 结合使用.
using GetDIBits() with BI_PNG is not allowed.
这篇关于GetDIBits() 因 PNG 压缩而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!