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.3-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 738d6ed61d1216c68d196456bab23efdae191a5269a434e8d2c7772d3387f8fd |
|
MD5 | 5e054e7bca44c6605203a235cf21e206 |
|
BLAKE2b-256 | a0016ed51a6bb5fef4f99554e32d5618cef67fb37f2b0bfca6724e68ec7dbbcd |
Hashes for rawpy-0.3.3-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 | c6d3329d9e982144bb4ac1529b3a45443930237705f31b956ebff6d08db23c1e |
|
MD5 | 5cd4841f2a427e0b75a6a150669c7b48 |
|
BLAKE2b-256 | 50945ce1479b3c01849eeaebdbd29eeeba4fd3c859ea17f40a550867d9dd72ba |
Hashes for rawpy-0.3.3-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8c4ac30516df99e11e2239e05490c1cad97c2729762f58ab0f2c3cf5af51c01 |
|
MD5 | c81d3e89ed3722f8fd08237a02aad9fc |
|
BLAKE2b-256 | 0999f0686c098a72113c5676082950b24d0fa3a0ea83ba98edde017325e58dc3 |
Hashes for rawpy-0.3.3-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 | 48c9b820222783a0729a84d35b4c90bc2bb2898962df6f2c3601c435be1f3904 |
|
MD5 | 268ba33001dbbe14fed776a75f644041 |
|
BLAKE2b-256 | b29f96b50212b02ccda53b79335cfd4d798b6244ac01bb20047b4647936b6009 |
Hashes for rawpy-0.3.3-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d1e64f13ea39af033966efbb3a28c9d778d694c203eabdb59fc66c2716085cb |
|
MD5 | fa8bcdf810bc770286edecb21c65aab7 |
|
BLAKE2b-256 | 2e5b449b659ac82a03f0164fd4b9ef7e6d9250650c34ecf73a3fb423ef6d1807 |
Hashes for rawpy-0.3.3-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 | 60e59421fd45d9b246c61235e3bd825d8f2af08f50f64a91167f1908e99a630c |
|
MD5 | c19eb264885129835205af2c6b4de63a |
|
BLAKE2b-256 | 7a28bf9d2b19c06e8384e07bb569f8261fc6be650244cac86cb4a975fc7d22d2 |