写入 10-bit/color(位深度)alpha 通道图像时出现问题
Problems writing 10-bit/color (Bit Depth) alpha-channelled image
我正在尝试使用 Image 模块创建具有 10-bit/color(位深度)的图像。
我写了以下代码片段,但结果是 8-bit/color:
from PIL import Image
im = Image.new("RGBA", (256, 256))
pix = im.load()
for y in range(256):
for x in range(256):
pix[x, y] = (1023, 1023, 1023, 255)
im.show()
im.save("10bit.jpg")
虽然图像成功写入新文件,但它仍然编码为 8 位通道:
$ exiftool 10bit.png
Bit Depth : 8
$ file 10bit.png
10bit.png: PNG image data, 256 x 256, 8-bit/color RGBA, non-interlaced
我的目标是写 Deep color (40-bit) 图片:
Deep color consists of a billion or more colors.[15] 230 is 1,073,741,824. Usually this is 10 bits each of red, green, and blue (10 bpc). If an alpha channel of the same size is added then each pixel takes 40 bits.
我在这里缺少什么?还有另一种方法可以创建 10 位 alpha 通道图像吗? (opencv等)
我正在尝试使用 Image 模块创建具有 10-bit/color(位深度)的图像。 我写了以下代码片段,但结果是 8-bit/color:
from PIL import Image
im = Image.new("RGBA", (256, 256))
pix = im.load()
for y in range(256):
for x in range(256):
pix[x, y] = (1023, 1023, 1023, 255)
im.show()
im.save("10bit.jpg")
虽然图像成功写入新文件,但它仍然编码为 8 位通道:
$ exiftool 10bit.png
Bit Depth : 8
$ file 10bit.png
10bit.png: PNG image data, 256 x 256, 8-bit/color RGBA, non-interlaced
我的目标是写 Deep color (40-bit) 图片:
Deep color consists of a billion or more colors.[15] 230 is 1,073,741,824. Usually this is 10 bits each of red, green, and blue (10 bpc). If an alpha channel of the same size is added then each pixel takes 40 bits.
我在这里缺少什么?还有另一种方法可以创建 10 位 alpha 通道图像吗? (opencv等)