-3

Is there a python module that will allow me to read an HDR image's dimensions? Standard python PIL library can't read HDR images. HDR references high dynamic range images. Photoshop can read this file format, but I have not been able to find any python module that can read this file format.

Update: PIL Image.open returns "IOError: cannot identify image file"

imghdr returns None when reading an HDR image file format.

panofish
  • 7,578
  • 13
  • 55
  • 96
  • **Welcome to Stack Overflow!** This post appears to be [off-topic](http://stackoverflow.com/help/on-topic) as per *Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam.* – vaultah Oct 04 '17 at 17:16
  • see imghdr. docs here https://docs.python.org/3/library/imghdr.html. also see this question https://stackoverflow.com/questions/8032642/how-to-obtain-image-size-using-standard-python-class-without-using-external-lib – Jacobr365 Oct 04 '17 at 17:22
  • @vaultah... I am interested in any workable answer and have yet to find anything that works. How else can I post this question? I need help from fellow developers. – panofish Oct 04 '17 at 20:49
  • @ Jacobr365... imghdr does not recognize HDR image format. HDR stand for high dynamic range image. – panofish Oct 04 '17 at 20:50

1 Answers1

0

There is a python module called smc.freeimage that can read HDR images. Works well, but the trick is getting the module installed successfully. Make sure you install the cython module first... then try easy_install instead of pip install.

import smc.freeimage as fi

filename = "myimage.hdr"

img = fi.Image(filename)

print "width =",img.width
print "height =",img.height
panofish
  • 7,578
  • 13
  • 55
  • 96