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.0-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24b3833e64a9032875434843fdceb4db564f12da06517bc26a483bdb58fe2d07 |
|
MD5 | a6f526dbaf31ce5e73da712866132eb9 |
|
BLAKE2b-256 | 2b10154dabcf10e221943a581eb117d1d39db10bf44caa25f9e9040f8c8e506d |
Hashes for rawpy-0.3.0-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 666e9cba7ac62d2d62fa06040afe09b56701f9047abc722387b348b9eb71d942 |
|
MD5 | d329e0907d734bf4ae7a4413fa09f6e4 |
|
BLAKE2b-256 | 99c1f492eb6547b3c396282eac44c6514577417b7682c24262e47084091857af |
Hashes for rawpy-0.3.0-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3702760ac61cfde54e17774c1fbc5631a748519bbf3a4f728fdbd05120ac21ff |
|
MD5 | ac0811b2c7a5e653e3e32d45dd7a605b |
|
BLAKE2b-256 | 0804318e9aca4baa3c92eb3884ec8cc2f5dfdcdec0d11d3092eb84489604ed5e |
Hashes for rawpy-0.3.0-cp33-cp33m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af1f7bc038045364fc491e7c8ff794fbc6712e27666f453b1086b480e6510e32 |
|
MD5 | 955d45ba08bc95cdcbd3103a6993f552 |
|
BLAKE2b-256 | 34c9b6a0a1efd4b3e719e8a37135ebb3f0826194a750497ae2d763b17188503e |
Hashes for rawpy-0.3.0-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15017824a5b86a3ac865954c60cf8750c840d559135f09d3db9242e8e3220cf8 |
|
MD5 | a636ac76186a98e31a439b318c092566 |
|
BLAKE2b-256 | f8ae9d345473f0d22cf5fc9217c4de134b2247247e75857c4c421021d18025de |
Hashes for rawpy-0.3.0-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0e52dba749629cfac917aade452416431d093f83a7ac12b12ee379c7dd8c040 |
|
MD5 | 76486ed8738dee6dd2c927592e359cee |
|
BLAKE2b-256 | 3dd3bf86241b6f10843695f4e6e802d5fa0dfa1f18724be6a12f9d1c06abb501 |