【发布时间】:2011-06-22 10:19:06
【问题描述】:
我正在尝试使用 Cocoa 框架*创建使用 RGBA 调色板(每个调色板条目 32 位)的 调色板 PNG 图像(每像素 8 位)。
我尝试了几种[NSBitmapImageRep initWithBitmapDataPlanes:…] 方法的组合。它似乎为bitsPerSample:2 bitsPerPixel:8 创建了适当的位图。
但是,当我尝试使用 [NSBitmapImageRep representationUsingType:NSPNGFileType…] 编写这样的位图时,我得到:
libpng error: Invalid bit depth for RGBA image
如果我尝试其他位深度,则会得到每像素 32 位(非调色板)的图像。
*) 我知道我可以使用 libpng,但这不是我要寻找的答案。
【问题讨论】:
标签: cocoa nsimage rgba nsimagerep png-8