RAW image processing for Python, a wrapper for libraw
Project description
rawpy is an easy-to-use Python wrapper for the LibRaw library. It also contains some extra functionality for finding and repairing hot/dead pixels.
Sample code
Load a RAW file and save the postprocessed image using default parameters:
import rawpy
import imageio
path = 'image.nef'
with rawpy.imread(path) as raw:
rgb = raw.postprocess()
imageio.imsave('default.tiff', rgb)
Save as 16-bit linear image:
with rawpy.imread(path) as raw:
rgb = raw.postprocess(gamma=(1,1), no_auto_bright=True, output_bps=16)
imageio.imsave('linear.tiff', rgb)
Find bad pixels using multiple RAW files and repair them:
import rawpy.enhance
paths = ['image1.nef', 'image2.nef', 'image3.nef']
bad_pixels = rawpy.enhance.find_bad_pixels(paths)
for path in paths:
with rawpy.imread(path) as raw:
rawpy.enhance.repair_bad_pixels(raw, bad_pixels, method='median')
rgb = raw.postprocess()
imageio.imsave(path + '.tiff', rgb)
Installation
Binary wheels for Linux, macOS, and Windows are provided for Python 2.7, 3.4, 3.5, and 3.6. These can be installed with a simple pip install rawpy. Currently, Linux and macOS wheels are only available as 64 bit versions.
Installation from source on Linux/macOS
If you have the need to use a specific libraw version or you can’t use the provided binary wheels then follow the steps in this section to build rawpy from source.
First, install the LibRaw library on your system.
On Ubuntu, you can get (an outdated) version with:
sudo apt-get install libraw-dev
Or install the latest release version from the source repository:
git clone https://github.com/LibRaw/LibRaw.git libraw
git clone https://github.com/LibRaw/LibRaw-cmake.git libraw-cmake
cd libraw
git checkout 0.19.0
cp -R ../libraw-cmake/* .
cmake .
sudo make install
After that, install rawpy using pip install rawpy --no-binary rawpy.
If you get the error “ImportError: libraw.so: cannot open shared object file: No such file or directory” when trying to use rawpy, then do the following:
echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/99local.conf
sudo ldconfig
The LibRaw library is installed in /usr/local/lib (if installed manually) and apparently this folder is not searched for libraries by default in some Linux distributions.
NumPy Dependency
rawpy depends on NumPy. The minimum supported NumPy version depends on your Python version:
Python |
NumPy |
2.7 |
>= 1.7 |
3.4 |
>= 1.8 |
3.5 |
>= 1.9 |
3.6 |
>= 1.11 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for rawpy-0.12.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65dc3b51507f4682f359e6ff37c1c36c1c5f65bd80ac2123947fa060a1f65602 |
|
MD5 | d8898db67340b631f63a749deca6b61e |
|
BLAKE2b-256 | 377073c7c52f4db517c20489a3b4c7e4c769275468df2f4a386a0d3989770975 |
Hashes for rawpy-0.12.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bdadcb917ed275a041ee8d754a6f82038b8bbf6292dc58987228cf2fd2727db |
|
MD5 | 65357b05f6b7ba024d40232b58ff46d2 |
|
BLAKE2b-256 | db59b9ecb5d9c60b6f6540cee84ce73365879ebbc6d481d86bf54f60f7d70c5b |
Hashes for rawpy-0.12.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 759995b830ef20d5e44f93b82bd61c68a80fd03ad8024d4e6f5482e7d839b5d0 |
|
MD5 | e099afcc782ac6e9a01ceaa8398f4ddd |
|
BLAKE2b-256 | b5fe3c54348ceee3cf66cefb4fb9937671acd94db919e88b31e224d79383785e |
Hashes for rawpy-0.12.0-cp36-cp36m-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e153ae1202eb74b6d15ae70bf925cf555e51b235b02ae235b1c5ea08a0c3430e |
|
MD5 | 780d3b1ab8ec8749021d1c233577225a |
|
BLAKE2b-256 | b54b5fc171915cbe1029194a679a8447d64236bec061b7d2b09f5e9ec6da531b |
Hashes for rawpy-0.12.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3807b26e2e8b0b58cf8d382a9684600a5eac822ab48004ed1fbe347feabff5d8 |
|
MD5 | de94983c4111ab963fb4336f9303af48 |
|
BLAKE2b-256 | 7cdef72f0401613780b7888c0a80270b3e535e8063c6a1bd3a6d37be3ab39ca1 |
Hashes for rawpy-0.12.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b8f2e3585bf1e5b48bde87fe4a8117f6db5f852d78379a7de8c1de9b9da8931 |
|
MD5 | f22d2aaa33cedef10b4cfb79af456ad3 |
|
BLAKE2b-256 | cb5b8efc7f3c56fe8275c97cbe9bd8781d2bf8ce9b2477183006c97639578c1e |
Hashes for rawpy-0.12.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39f194cfb5abeccba9a9e55735338f1e0a9bfc2c1d0296401fefc0b12da04929 |
|
MD5 | 516f40d09e37b792b7319e131dc98477 |
|
BLAKE2b-256 | 2df1443a2879551d0531e94aba940362dbd2234448e5c41533b0b555cefbacb5 |
Hashes for rawpy-0.12.0-cp35-cp35m-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ea24cdcb5999fb9b03808ccd73e76f2621c4314a6fe7c694122b738c593160e |
|
MD5 | c814f8a1f69d0cc4e70f9ba83c153466 |
|
BLAKE2b-256 | 27a2116b11720b6909c5d07f491e436947d39ec35af5e5a4bec754768f55fc85 |
Hashes for rawpy-0.12.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9f0e66ad020bf61eb43fdcc67f669814512991b84369c95401a3cd84ae41dbd |
|
MD5 | b195a6a08419ca6ad7ebdba39ac09151 |
|
BLAKE2b-256 | b5b388f35c2aaa8b94204d6ee612bfb4d76f84dc90da1f984335da6deb453172 |
Hashes for rawpy-0.12.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c62ffcc57a329b3c0cd897394e9d49c1e521e3623668f496b78c6fa9b27a20e3 |
|
MD5 | 4ba1ce34e026b6469ce26a9d957c185b |
|
BLAKE2b-256 | 0c8c40bd7b164b924f0b6067d59592bf97a3c41ad20aaf9aac49fcf51e5ea1b2 |
Hashes for rawpy-0.12.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cd722f70b06f723941aef0dc273f5d19f6916059f0f70826c9a4ba4d483b54f |
|
MD5 | 3d22d49df163d3351e7fad801973f8a0 |
|
BLAKE2b-256 | fe7aa8aeb0bbb29ca33a3fe92ac26c1c1b7aa907f3932572d485170285fe1f1d |
Hashes for rawpy-0.12.0-cp34-cp34m-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5d904464e12e220845afba4a8d5dfa8ead8ef71082b0778c2857521bce6a0a7 |
|
MD5 | 4d901b5d8f90f8f0b0abdd0bb9b10f2f |
|
BLAKE2b-256 | c085e4b8fbcc996442e2299b47788b60db2ca1d9429794ad7feece2c42e2d567 |
Hashes for rawpy-0.12.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df03c84f3d34cf73410e3431714d3a995b227b51eaec623b158e8074417faf2b |
|
MD5 | 69c19b5f6594711eaffd5cfe512c3108 |
|
BLAKE2b-256 | f1ee4bccd7b9305f69f942e0197a5a429c35add0c0dfc628b99504d62dbaf232 |
Hashes for rawpy-0.12.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 445ed4f48b5b7139c3e1498a89ebf061821887d5b11cbf8e2ef6441356f5b46e |
|
MD5 | 582c0e82f40444bc5bf79b0efe8655ad |
|
BLAKE2b-256 | 331510fc2ab17b7063a7eefb28cbced3b0bfca08198c89e757ca7ec98096ea1f |
Hashes for rawpy-0.12.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7acb13c45f201d04efc185d99cf5913501031f7facabec9573e07f92a3a34bc |
|
MD5 | fa20301723844e90a8e6056ec5f38302 |
|
BLAKE2b-256 | e04e6a1f4c823047fc6b47375480dc17ab5ec4333ba545cc68626e0c0ee0fa9e |
Hashes for rawpy-0.12.0-cp27-cp27m-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 794cf4ea64a3167e609fd8c71074ebfa127aa7b673d1746ba56e6cc01653d0e6 |
|
MD5 | feb5122ab1e8c5e1843b283f60188731 |
|
BLAKE2b-256 | ac7998b1c8e49a81a2d9f385fea22995aebcaddf7bcd76ce6372178e92a7760b |