-2

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.

4
  • Welcome to Stack Overflow! This post appears to be off-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. Commented Oct 4, 2017 at 17:16
  • see imghdr. docs here docs.python.org/3/library/imghdr.html. also see this question stackoverflow.com/questions/8032642/… Commented Oct 4, 2017 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. Commented Oct 4, 2017 at 20:49
  • @ Jacobr365... imghdr does not recognize HDR image format. HDR stand for high dynamic range image. Commented Oct 4, 2017 at 20:50

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.