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.5-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3f4127dfdbda61153d99d278094bd1d98a8c4c2ac282aac8d60b1a8c1588568 |
|
MD5 | 01818fa12e1070a7c4d9684293094237 |
|
BLAKE2b-256 | 91c0a3fed6b7697edeb163f414d5c16278dde3ac049a1ff0e30f9744834148c7 |
Hashes for rawpy-0.3.5-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c2e3b66a3edf77432c68477163a08a75af5390ba34b1b9828169f3b9f6c224a |
|
MD5 | 8f7a9d3581e82b7e6069558591037d53 |
|
BLAKE2b-256 | 281736fe96c70c2d0a21b6e2153c01c1a09239c55e0e8ddc6aea6d3ab0a7e695 |
Hashes for rawpy-0.3.5-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe82017b0aef38f9368b34f64be230e05ad93a43544b9761dc3894e91e9b913 |
|
MD5 | f58cc5a71ce00dbc1ee29894ff332c4e |
|
BLAKE2b-256 | 7128672f88f829f0ca9595262c7f867139a04a76578b4060d856cff964d61101 |
Hashes for rawpy-0.3.5-cp33-cp33m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd134102722a3627ad1820ebf03715fc1c82aa490896585c3efb1624ee19f6c4 |
|
MD5 | 9cbeebcdc770ffff452bed3f23864718 |
|
BLAKE2b-256 | 59e4017bb41e8ef73afa50546a6a1184140d02778b74bd7485753e0f64b597be |
Hashes for rawpy-0.3.5-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef45eaad9a1031ff49a11761cd9399ff6b76e730df26141cd6fc7e0f1c70165c |
|
MD5 | 9e951ae839a01a4f412aeda0c45c8435 |
|
BLAKE2b-256 | 6716929eee34eda3ce2dc4a3b544302d42995b087d96c9e4165c794a5764466b |
Hashes for rawpy-0.3.5-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f62898b301b665b316650c56b854dd0e8084974730dc49a2df0fc1b9e6732105 |
|
MD5 | f790f9f5de289f38607321083ad3b51b |
|
BLAKE2b-256 | 80cc5199c9809bfcc9859653ecd2cd2b93bed51fbe762f5d5936da4687955e14 |