Python wrapper for the LibRaw library
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'
raw = rawpy.imread(path)
rgb = raw.postprocess()
imageio.imsave('default.tiff', rgb)
Save as 16-bit linear image:
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:
raw = rawpy.imread(path)
rawpy.enhance.repair_bad_pixels(raw, bad_pixels, method='median')
rgb = raw.postprocess()
imageio.imsave(path + '.tiff', rgb)
Installation on Linux
You need to have the LibRaw library installed to use this wrapper.
On Ubuntu, you can get (an outdated) version with:
sudo apt-get install libraw-dev
Or install the latest developer version from the SVN repository:
git clone git://github.com/LibRaw/LibRaw.git libraw
git clone git://github.com/LibRaw/LibRaw-cmake.git libraw-cmake
cp -R libraw-cmake/* libraw ;
cd libraw
cmake .
sudo make install
After that, it’s the usual pip install 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 and apparently this folder is not searched for libraries by default in some Linux distributions.
Installation on Windows and Mac OS X
Binaries are provided for Python 2.7, 3.3 and 3.4 for both 32 and 64 bit. These can be installed with a simple pip install --use-wheel rawpy (or just pip install rawpy if using pip >= 1.5).
Binaries for other Python versions are currently not produced but if there is a need then this is possible as well. In that case, just contact me.
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.3.1-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b3f55275081193706ac5d0669d8208db21f25722f51b1b85c4e33646c781540 |
|
MD5 | 39edf19265607dbb9b9371a60714e271 |
|
BLAKE2b-256 | d71e6578b03b407214f0317218576636b4980540f786cb6d20c5ea1b358b2527 |
Hashes for rawpy-0.3.1-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cdbf114a79bd54db6993dddd8e5dc8ef1072e6c2130341452be989d0d4a50d5 |
|
MD5 | 0d7f9368f2735164d5ac802683161631 |
|
BLAKE2b-256 | a28a3199ce9784b4a4e1c0fffd263e91353ded4b294fe06cc33bda7964f15804 |
Hashes for rawpy-0.3.1-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59acc6c304a702b247de2c44c2fc8fe34a8f5d79d9ac569d7678e0329df217e3 |
|
MD5 | c0dfd749a2033d2c33ad79968c9ab190 |
|
BLAKE2b-256 | 8abe74209d73e0b7ff29d724a07ba39f2aad2f8fdbc3ea2622d83b307290c3c9 |
Hashes for rawpy-0.3.1-cp33-cp33m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e129096a11337cd66d6fa299e853addc959a9e3c3072e82f87614c920e6a8365 |
|
MD5 | 713907a45021720f8f6f10b4296e554b |
|
BLAKE2b-256 | 7883c039de5d68388a4990c50ba5b2e4b457655fc524be7fa2074ec8e5b8c711 |
Hashes for rawpy-0.3.1-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f646c9f743a676478ebb020b7a2726cc1b31e6ef7c0ae06279f74251912ea3d |
|
MD5 | 837423023170b362ce0e2b09a17a9780 |
|
BLAKE2b-256 | 64b039c2908a81feeaedd4b1fd0cb992704f4f958acea1dedcbd48b8943c70e8 |
Hashes for rawpy-0.3.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 327040781bb23feb9bd3c492385c031d794e81ad8ce601c358a6d81942d3823d |
|
MD5 | 84ed12b995870eeeeba31818a42228db |
|
BLAKE2b-256 | 1b58302904919afc03dd59b6cd5e73b246656a474c5ccacc41eba1b130554c54 |