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.11.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e28df75f61bdd873a7beaaf15f6aa258354f53d35e70d9285a2360b2e147b95c |
|
MD5 | ad0129534be45bee31feebf3189f83a3 |
|
BLAKE2b-256 | bd5127e0700c473efa2be0edb3ebf0d420e3c7e3d1a56483ecfdd830f13f5ba4 |
Hashes for rawpy-0.11.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dc6bca847edb9e0a9b86c3fb3d204fdcf0cef9af505189db1a1e7fbbacb9f03 |
|
MD5 | a28fbf12a1122d06aec364da2c01b953 |
|
BLAKE2b-256 | ba297e92240027b0b96edb3ac505098ddf686db97c1fc09d79caac5ec35d560d |
Hashes for rawpy-0.11.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59fde175bad9fd20637ac04bf3f883d4b140704ebafa71f6900f806ec15595d9 |
|
MD5 | fe02ad8ca63526946c4efbe797230a80 |
|
BLAKE2b-256 | db10727a435d6228007944c07357e697f35d998cf4f11ee8757b0367db4950bd |
Hashes for rawpy-0.11.0-cp36-cp36m-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 065943fa533c6c7e13c17e7de593927307711c1699aeef5edff36f8e90db5373 |
|
MD5 | 20c76aaf1af511a8fc456732be3984c5 |
|
BLAKE2b-256 | aa90c53bd81c56280d4362adb59bc7c5537ed59a90f63b07d991e3d72e618f82 |
Hashes for rawpy-0.11.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eac49f4a2b8a527024b34df0880edc45140337b522cd570dc73c5d11eb309922 |
|
MD5 | 673027ba16e55190d0fe6ea1c94240fb |
|
BLAKE2b-256 | 4bd0911e230a400a38a898e6bc28e9a88d805be62da44497372f60add4c6b9aa |
Hashes for rawpy-0.11.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca884ae86624021052af4e5006d10e21bf55a9eafe0a5670243026fbbe7f4fb7 |
|
MD5 | 7efa8747c52b5a7f755ed35365568d2d |
|
BLAKE2b-256 | 10d3346bf2aa3d5f58caa7666651eab5e9b28ed7de0451d5e732bc5c2d52760b |
Hashes for rawpy-0.11.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed426c192ae2b565d3367a8bfb0c2dece9f27a5f13ee89fd748a83269144ff9c |
|
MD5 | 928bfcfe8fa7e06195dfbc6235642f92 |
|
BLAKE2b-256 | 2fd9b46b70b560b5cf4b010d8a7253d1fe820ce323a812ffe6b882b5dfd3d5b4 |
Hashes for rawpy-0.11.0-cp35-cp35m-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55bac73d61f74f34a092e67b4c59799cb2f3d0c11f6ab981a49fc0554bf5ffad |
|
MD5 | c7d801b292cb84d16a5d36866a3d4eb1 |
|
BLAKE2b-256 | 6e7f0f22131974334da86a5e1d13d5b2dfa7b71236733d45fc6a038825ce6a08 |
Hashes for rawpy-0.11.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 062fdc7a69eaed4fd8cce1e2f9c0eeecc32d2e49a6191fd7046386ff7ce9f7f2 |
|
MD5 | 7d77bb8482a51d68c8e104b78d6602c3 |
|
BLAKE2b-256 | 0c0b00572b7da25f89ca0961d1e83d6f4b5364f2fbec03ab327afa207fe5a648 |
Hashes for rawpy-0.11.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb7708cddbdb1da1a334ce89dd4510e9702400b28d136eeaf35dc39c14c63889 |
|
MD5 | 4479a2b945146b00f3b9214499503eb2 |
|
BLAKE2b-256 | eed9cbbe7d2281be7fda76fd9a8500e6a318c17ac8ce6418cebbc6fc205db77f |
Hashes for rawpy-0.11.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a8f2603d9f01aca01e0bd21b0dec21c62f342f5c81377eacee6f58803aa70e8 |
|
MD5 | b341816ae01ad5cc98539a68c9a55a12 |
|
BLAKE2b-256 | 4fb74842077f01121cc445ce67ae9bd599f33b7d46ca64e5726b330e73d3148c |
Hashes for rawpy-0.11.0-cp34-cp34m-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a7c1123074d351e1d449fc2e523abce2f66ee583e3a4af1e02206c8afbffe79 |
|
MD5 | db53a5e8877d3866f09c2229c42c0431 |
|
BLAKE2b-256 | 141bf4f6bb07cad8c80a21af3a25b2c432643f0dc7f0a1bc56148d933e29bac3 |
Hashes for rawpy-0.11.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ada5d3031befad49e1fa7e5bea427ef4b1a94090f139829dbb931e6844c1e7ca |
|
MD5 | 4fce5a1bd172e6a7d2d51bb0ba1ea68e |
|
BLAKE2b-256 | 42fbe0db998cfa88e6e0766d24780e383e6af9093fb33cfd4cfab8e213844f58 |
Hashes for rawpy-0.11.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0332a3ba0a68168ae188164dbb61bdde90f3796a22448722ad9746b4b5c67ce1 |
|
MD5 | 5cff6eaa8c152008f21f2795324ce15b |
|
BLAKE2b-256 | 14c187989633bd62c2a2e2c073bd6ec9d4612bb364677caa1348ca7994c33f1e |
Hashes for rawpy-0.11.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50c4f785838a7641df9f01680656bc28aba6b35810d63870f58df5630821a19c |
|
MD5 | 492e71a3089a0ffb3274329d74c58e18 |
|
BLAKE2b-256 | 42ca7afbe067c75871e72935bcc89cdc8d48192ee8012e8f95403f411d9595e3 |
Hashes for rawpy-0.11.0-cp27-cp27m-macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c95ceef91cf6d8d714e85b7822c1a191a2b7770e218cd666ef467a0ccd7c78fc |
|
MD5 | 1bd7a221662943814934f3ea05376f24 |
|
BLAKE2b-256 | 9ac260f0b695a610d97f61e839d3b34e9f70c63bab6954adb6715199fc0935f9 |