有没有 c++ 的库(或工具)用 alpha 值减少 PNG 图像中的颜色?

发布于 2024-12-25 10:53:34 字数 189 浏览 2 评论 0原文

我有一个带有 alpha 值的 PNG 图像,需要减少颜色数量。我需要图像中的所有颜色不超过 256 种颜色,到目前为止我尝试过的所有操作(从油漆店到 leptonica 等...)都会剥离图像的 Alpha 通道并使其无法使用。有什么东西可以满足我的要求吗?

编辑:我不想使用 8 位调色板。我只需要减少颜色的数量,以便我自己的程序可以处理图像。

I have a PNG-Image with alpha values and need to reduce the amount of colors. I need to have no more than 256 colors for all the colors in the image and so far everything I tried (from paint shop to leptonica, etc...) strips the image of the alpha channel and makes it unusable. Is there anything out there that does what I want ?

Edit: I do not want to use a 8-bit palette. I just need to reduce the numbers of color so that my own program can process the image.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

感悟人生的甜 2025-01-01 10:53:34

具有 Alpha 透明度的 8 位 PNG 只会在较新的网络浏览器上渲染 Alpha。

以下是一些进行转换的工具和网站:

免费 pngquant

Adobe Fireworks

和网站:http://www.8bitalpha.com/

另请参阅类似问题

8-bit PNGs with alpha transparency will only render alpha on newer webbrowsers.

Here are some tools and website that does the conversion:

free pngquant

Adobe Fireworks

and website: http://www.8bitalpha.com/

Also, see similar question

め七分饶幸 2025-01-01 10:53:34

您描述的问题是 PNG 格式固有的。请参阅 维基百科 的条目,并注意颜色选项表中没有 的条目索引&阿尔法。可以为 256 种颜色中的每一种添加 Alpha 值,但通常只有一个调色板条目将完全透明,其余部分将完全不透明。

Paint Shop Pro 有几个选项用于混合或模拟调色板 PNG 中的部分透明度 - 我知道,因为我写了它。

The problem you describe is inherent in the PNG format. See the entry at Wikipedia and notice there's no entry in the color options table for Indexed & alpha. There's an ability to add an alpha value to each of the 256 colors, but typically only one palette entry will be made fully transparent and the rest will be fully opaque.

Paint Shop Pro has a couple of options for blending or simulating partial transparency in a paletted PNG - I know because I wrote it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文