tvogels / pyexr Goto Github PK
View Code? Open in Web Editor NEWOne-line EXR IO-library
Home Page: https://github.com/tvogels/pyexr
License: MIT License
One-line EXR IO-library
Home Page: https://github.com/tvogels/pyexr
License: MIT License
Hi @tvogels ,
I was wondering if you could bump the version and release the new version of pyexr to pypi? Thanks!
Hi ,
Thanks for the great work,
while I'm trying to reproduce the WRITING part result as the readme file wrote, I have no idea where the 'depth' variable comes from, can you shade me a light.
Thanks
OpenEXR.so: undefined symbol: _ZNK3Imf14TypedAttributeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE12writeValueToERNS_7OStreamEi
Hey tvogels! I was wondering if you could make a patch release to pypi containing the changes from the past few years? thanks!
np.fromstring
here is deprecated:
/usr/local/lib/python3.6/dist-packages/pyexr/exr.py:241: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
np.fromstring(strings[i], dtype = precision) \
It looks like there are slight nuances between fromstring and from buffer (read only, perhaps byte order, who knows) so I wasn't comfortable making the change myself.
Hi, I got the below error message when I install OpenEXR on Windows 10. Is there any solution to this? Thanks a lot.
C:\Users\63040>pip install OpenEXR
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting OpenEXR
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a6/b9/8cb5f0b2634d8e4a2fab2d188cd108011a676835f33b14c069c0d84cd494/OpenEXR-1.3.8.tar.gz (11 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: OpenEXR
Building wheel for OpenEXR (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
Looking for libOpenEXR...
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-39
copying Imath.py -> build\lib.win-amd64-cpython-39
running build_ext
building 'OpenEXR' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for OpenEXR
Running setup.py clean for OpenEXR
Failed to build OpenEXR
Installing collected packages: OpenEXR
Running setup.py install for OpenEXR ... error
error: subprocess-exited-with-error
× Running setup.py install for OpenEXR did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Looking for libOpenEXR...
running install
D:\Code\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-39
copying Imath.py -> build\lib.win-amd64-cpython-39
running build_ext
building 'OpenEXR' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> OpenEXR
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Using this code :
from PIL import Image as im
import numpy as np
file = pyexr.open("frame_0000.exr")
img = file.get("Image")
data = im.fromarray(img, 'RGBA')
data.show()
here is the source file
I need the png image to be the same as the image from the exr.
Or in python extract a specific layer from an exr image.
Hi, I got the below error message when I install pyexr on Windows 10 with conda, and I have installed OpenEXR. is there any solution to this? Thanks a lot.
(openexr) C:\Users\CHENN>pip install pyexr
Processing c:\users\chenn\appdata\local\pip\cache\wheels\03\b7\93\fb457a606b9a72af7fcdf620cc8c0ba10421c89b39c411240e\pyexr-0.3.7-py2.py3-none-any.whl
Processing c:\users\chenn\appdata\local\pip\cache\wheels\8b\99\a0\81daf51dcd359a9377b110a8a886b3895921802d2fc1b2397e\future-0.18.2-cp36-none-any.whl
Collecting OpenEXR
Using cached OpenEXR-1.3.2.tar.gz (10 kB)
Collecting numpy
Downloading numpy-1.18.2-cp36-cp36m-win_amd64.whl (12.8 MB)
|████████████████████████████████| 12.8 MB 6.8 MB/s
Building wheels for collected packages: OpenEXR
Building wheel for OpenEXR (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\Anaconda3\envs\openexr\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CHENN\\AppData\\Local\\Temp\\pip-install-q1mffmic\\OpenEXR\\setup.py'"'"'; __file__='"'"'C:\\Users\\CHENN\\AppData\\Local\\Temp\\pip-install-q1mffmic\\OpenEXR\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\CHENN\AppData\Local\Temp\pip-wheel-c95sgsnx'
cwd: C:\Users\CHENN\AppData\Local\Temp\pip-install-q1mffmic\OpenEXR\
Complete output (15 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying Imath.py -> build\lib.win-amd64-3.6
running build_ext
building 'OpenEXR' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/opt/local/include/OpenEXR -ID:\Anaconda3\envs\openexr\include -ID:\Anaconda3\envs\openexr\include "-Ic:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include" "-Ic:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /TpOpenEXR.cpp /Fobuild\temp.win-amd64-3.6\Release\OpenEXR.obj -g -DVERSION="1.3.2"
cl : Command line warning D9002 : ignoring unknown option '-g'
OpenEXR.cpp
OpenEXR.cpp(36): fatal error C1083: Cannot open include file: 'ImathBox.h': No such file or directory
error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for OpenEXR
Running setup.py clean for OpenEXR
Failed to build OpenEXR
ERROR: pymanopt 0.2.4 requires scipy>=0.17, which is not installed.
Installing collected packages: future, OpenEXR, numpy, pyexr
Running setup.py install for OpenEXR ... error
ERROR: Command errored out with exit status 1:
command: 'D:\Anaconda3\envs\openexr\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CHENN\\AppData\\Local\\Temp\\pip-install-q1mffmic\\OpenEXR\\setup.py'"'"'; __file__='"'"'C:\\Users\\CHENN\\AppData\\Local\\Temp\\pip-install-q1mffmic\\OpenEXR\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\CHENN\AppData\Local\Temp\pip-record-ywt2yr3c\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Anaconda3\envs\openexr\Include\OpenEXR'
cwd: C:\Users\CHENN\AppData\Local\Temp\pip-install-q1mffmic\OpenEXR\
Complete output (15 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying Imath.py -> build\lib.win-amd64-3.6
running build_ext
building 'OpenEXR' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/opt/local/include/OpenEXR -ID:\Anaconda3\envs\openexr\include -ID:\Anaconda3\envs\openexr\include "-Ic:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include" "-Ic:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /TpOpenEXR.cpp /Fobuild\temp.win-amd64-3.6\Release\OpenEXR.obj -g -DVERSION="1.3.2"
cl : Command line warning D9002 : ignoring unknown option '-g'
OpenEXR.cpp
OpenEXR.cpp(36): fatal error C1083: Cannot open include file: 'ImathBox.h': No such file or directory
error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\Anaconda3\envs\openexr\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CHENN\\AppData\\Local\\Temp\\pip-install-q1mffmic\\OpenEXR\\setup.py'"'"'; __file__='"'"'C:\\Users\\CHENN\\AppData\\Local\\Temp\\pip-install-q1mffmic\\OpenEXR\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\CHENN\AppData\Local\Temp\pip-record-ywt2yr3c\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Anaconda3\envs\openexr\Include\OpenEXR' Check the logs for full command output.
In case anyone has trouble installing pyexr on mac, I found the following commands work well in my case.
brew install openexr
conda install -c conda-forge openexr-python
pip install pyexr
Hi,
is there a way to write a deepscanline instead of scanlineImage ?
Cheers
I'm trying the Simple files
example.
Hi, Could you help me to modify your script? I would like to specify if a channel should be named with a lower or upper letter after the dot.
example :
albedo.r or albedo.R
Thanks
I don't know if I'm doing something wrong. Opening files written by pyexr in other programs causes weird behaviour.
import numpy as np
import pyexr
import imageio
pyexr.write("test.exr", np.asarray([[0,1],[2,3]], dtype=np.float32))
print(pyexr.read("test.exr"))
print(imageio.imread("test.exr"))
The Output is:
[[[0.]
[1.]]
[[2.]
[3.]]]
WARNING:root:imageio.freeimage warning: Warning: loading color model Z as Y color model
[[0. 0.]
[0. 0.]]
https://github.com/tvogels/pyexr/files/5156542/test.zip
I also tried gimp, but it refuses completely to open the files, saying that the corresponding plugin crashed.
Edit: Using the 'Y'-channel for writing, reading the file back in works, but because of the different color-interpretation I won't consider this as a usable workaround. Maybe the problem has to be searched in the OpenEXR python-library.
When I use Numpy methods on an image returned from pyexr.read()
then Pylance gives me a warning.
E.g. VS Code gives me a red squiggle on .shape
on the last line of this code:
import pyexr
impath = 'image.exr'
im = pyexr.read(impath)
im.shape
The full warning from Pylance is:
Cannot access member "shape" for type "Dict[str, ndarray[Unknown, Unknown]]"
Member "shape" is unknownPylance[reportAttributeAccessIssue](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportAttributeAccessIssue)
I saw that you recently added type hints, however the issue seems to be that read()
can return either an image or a dict.
A work around is to add a cast()
wrapper:
from typing import cast
import pyexr
from numpy import ndarray
impath = 'image.exr'
im = cast(ndarray, pyexr.read(impath))
im.shape
This code gives no warnings from Pylance.
Instead of casting, adding an assertion also works:
assert isinstance(im, ndarray)
I think it would be great to be able to read and write the EXR header from pyexr. In particular, I'd like to be able to access the header attributes and add custom attributes.
Would you be interested in a patch with this feature? I think it could be implemented quite simply as an optional feature for users who need it without cluttering the basic interface.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.