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, 3.4 and 3.5 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.5.0-cp35-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bfba91aea5172ba86f744faa39b7f446795f04c0870b0613230ac3499197baa |
|
MD5 | 019ff91bca501f33257602eca5070bad |
|
BLAKE2b-256 | 461001dd803cdc3921ee431c62d8bb0a5f7a7595ad674e3f324665ca45985629 |
Hashes for rawpy-0.5.0-cp35-cp35m-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 | a6822b35e6ba6cb6194dbcb4a33a38b0193844b1f6e7bcdee02409b9c637e69c |
|
MD5 | 0556ec2ee7d7d046c6ff9e7531bcb842 |
|
BLAKE2b-256 | a8e3168bd8073d545d956cf57452674b04bffbe96e1e33e62a4f21abe23524eb |
Hashes for rawpy-0.5.0-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3be1f19715e4b1450f20070612810d973499674f4bae2ee60d8cdde9f1b7e82a |
|
MD5 | 3a6b135ebfa67dfba86757c75a11f79e |
|
BLAKE2b-256 | c23bba2df1469472155adb5716563e3b406ca3dfd13d18f525c4a3459dc56e20 |
Hashes for rawpy-0.5.0-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 | 69bc6c4fab6cacd5a01d09463d7ce574e202f8894e3c644853ca8a1de675f688 |
|
MD5 | ca0478210d9c4d89b6bd2c68474d6a85 |
|
BLAKE2b-256 | d806d83f9ca6544ce76343ed2e600d4afb5bdbe7b96fd0f65cb0ffa3350e39d7 |
Hashes for rawpy-0.5.0-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 193bbac84b9f48a7b82fe1ceee34660bd8845ab09af8749f17f2be937f3e81a0 |
|
MD5 | 37507ad65fbdd08c1d20231052e04a35 |
|
BLAKE2b-256 | dca746cf46e5e27a98d534ddd09d46c7d32194911bf92940d4b7c726a1712ec5 |
Hashes for rawpy-0.5.0-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 | a1199413d71be3bf00fa6aea35be8a4b699f410d39f6f2c2725352cb347bfaec |
|
MD5 | 44cb7a18321b2b9ada08d2ef103837b3 |
|
BLAKE2b-256 | 6716b5072939f0df88275937a838e4b8c1243a1d792ba6b4d9aa1b8216948c94 |
Hashes for rawpy-0.5.0-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d04fc7d97a6bd2539927c50b34ba889b879921f4f266aa98e3325daae148165c |
|
MD5 | fa88c6e98515cf89218592130f235c60 |
|
BLAKE2b-256 | cb618bb8413a6835d6e906c7ce8d80854060f01c1c20f2ce77c1ff33adbf9675 |
Hashes for rawpy-0.5.0-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 | dae547e1a8c4e6149c48a35d264e76a87a275111f8dd22391e8d1bf3dbbd8133 |
|
MD5 | 87efadea939de60bc54c26a73351ab3f |
|
BLAKE2b-256 | 3471b427b68aa04dac4010b53f03deb05290e8caa6452f5f05a1eb1e3e05b395 |