如何通过Python获取HDR图像尺寸?

时间:2017-10-04 17:11:07

标签: python hdr

是否有python模块可以让我读取HDR图像的尺寸? 标准的python PIL库无法读取HDR图像。 HDR参考高动态范围图像。 Photoshop可以读取此文件格式,但我找不到任何可以读取此文件格式的python模块。

更新: PIL Image.open返回" IOError:无法识别图像文件"

imghdr在读取HDR图像文件格式时返回None。

1 个答案:

答案 0 :(得分:0)

有一个名为smc.freeimage的python模块可以读取HDR图像。效果很好,但诀窍是成功安装模块。确保先安装cython模块...然后尝试使用easy_install而不是pip install。

import smc.freeimage as fi

filename = "myimage.hdr"

img = fi.Image(filename)

print "width =",img.width
print "height =",img.height