c - RGBA png alpha 处理

标签 c png alpha

我有一个 RGBA PNG 文件(我认为)是从数字化平板电脑上捕获的签名。提取图像时,如果像素在最终图像中带有色调,则所有 RGB 三元组均为 0,0,0,并且 alpha channel 值非零。我明白了这一切。

此 PNG 仅具有 IHDR、IDAT 和 IEND block 。

My first question is, are my RGB pixels considered the foreground or the background? What might be the proper terminology to describe this file/image?

What equation do I use to apply the alpha to the RGB.

查看 alpha 值,我可以看到如何得出一个数字,但是将使用什么通用方程来生成适当的 RGB 值,避免在我的 RGB 一开始就非零时出现除以 0 或溢出值错误值。

我已经阅读了 PNG 规范,但有一些东西我不明白。

顺便说一句,我最终用 C 语言生成一个 PCL 文件,用于直接打印到 PCL LaserJet。

最佳答案

最后显示的图像是前景图像。单个图像中没有前景和背景。

此链接展示了如何将带有 Alpha 的图像混合到另一个图像。:

http://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending

关于c - RGBA png alpha 处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27005410/

相关文章:

iphone - 如何在 iPhone SDK 中将图像保存为带有 alpha channel 或 alpha mask 的 Tiff 或 PNG?

c - 等待多个事件而不进行轮询

CreateDirectory() C (Windows VISTA/XP)

c++ - 如何使用 CImg 库打开 PNG 而不丢失 alpha channel ?

python - pygame 将图像的透明部分传输为白色

javascript - 打开侧面菜单时更改正文的 alpha 值

c - 使用 NLOPT SLSQP(基于梯度的算法)时 C 中的 NLopt nullptr 异常

c - 这个 C 声明 int *(*table())[10] 是做什么的?

node.js - GraphicsMagick for Node.js(GM 模块)性能

java - PNGj,元数据不被保存