【问题标题】:Creating 32bit RGBA images创建 32 位 RGBA 图像
【发布时间】:2015-02-10 09:42:12
【问题描述】:

什么是可以创建图像并将其保存为 32 位 RGBA 格式以供 OpenGL 使用的免费程序?

或者我应该在 python 中将它们全部转换吗?

【问题讨论】:

  • 您的意思是PNG RGBA 文件吗?还是没有标头的纯 RGBA?
  • 老实说我不知道​​,我猜是openGL能读到的东西

标签: image alpha rgba


【解决方案1】:

您可以使用 ImageMagick 轻松做到这一点 - 可免费用于 Windows、Linux 和 OS X。它包含在大多数 Linux 发行版中 - 试试 convert -version。在 OSX 上,使用 homebrew 安装 brew install imagemagick

# Create 32-bit RGBA image 2 pixels wide and 5 pixels high
convert -size 2x5 xc:"#1A2B3C80" -depth 8 fred.rgba 

# Check with "xxd" grouping in 4 bytes (1 RGBA pixel)
xxd -g 4 -c 8  fred.rgba
0000000: 1a2b3c80 1a2b3c80  .+<..+<.
0000008: 1a2b3c80 1a2b3c80  .+<..+<.
0000010: 1a2b3c80 1a2b3c80  .+<..+<.
0000018: 1a2b3c80 1a2b3c80  .+<..+<.
0000020: 1a2b3c80 1a2b3c80  .+<..+<.

如果你有这样的图片,例如

如果你想让柠檬绿变得透明,并且它是一个 32 位 RGBA PNG 文件,你可以这样做:

convert input.png -transparent lime PNG32:out.png

给这个:

【讨论】:

  • 谢谢。顺便说一句,我有 Windows 7,但这可以用来将 rgb 图像(.png、jpg 或 bmp)转换为 rgba 图像,并选择一种颜色以使 alpha 为 0?
  • 是的,请再看看。
  • 对,我设法找到了一个 .exe 文件并安装了 imagemagick,但我无法转换随附的 Image 文件夹中的任何图像。
  • 你能做到identify -version吗?还有convert rose: a.jpgconvert rose: a.png?
  • 我可以做到identify -version:给imagemagick 6.9.0-5 Q16 \times 64 2015-01-31 http:www.imagemagick.org,版权,Features:DPC Modules OpenMPDelegates &lt;built-in&gt;: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib。但是当我做convert rose: a.jpg 时,我得到convert.exe: unable to open image 'rose': No such file or directory @ error/blob.c/OpenBlob/2674. convert.exe: no decode delegate for this image format '' @ error/constitute.c/ReadImage/501. convert.exe: no images defined 'a.jpg' @ error/convert.c/CopnvertImageCommand/3212.
【解决方案2】:

Paint.net 效果很好 - 只需要创建具有两层或多层的图像,使一层透明,然后将其保存为 32 位 png。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多