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.findBadPixels(paths)
for path in paths:
raw = rawpy.imread(path)
rawpy.enhance.repairBadPixels(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
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.2.0-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99ff1756612c0a50719a49770c41c83997676d50a2902845652e5b30867623fc |
|
MD5 | db2e93a3f6e02b046127c6e0db4e1823 |
|
BLAKE2b-256 | 8ea55b69c92024b0a49bd0c812e9ad40f2779a713eff3c88fa186515fcf20b2f |
Hashes for rawpy-0.2.0-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90cb6b87d1effb54af06ca33b7bd1251b2ce18fec148409cd335bbc57818a0e8 |
|
MD5 | 4bdaf4c97c9fa49493b26c8a417abd85 |
|
BLAKE2b-256 | b30748fafc0f4fbfd0e9fb73f521bf10a8b43f053d397391cd27c05a39af5926 |
Hashes for rawpy-0.2.0-cp33-cp33m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cd98a6df2385df7f7c2d2bf07d4e876044d9dfcbacadf8c8f4bc9b65f916fe5 |
|
MD5 | 65979e06886b2c3d17b56dea689163db |
|
BLAKE2b-256 | 963ff94f21786d9383291f7d5a52f7b38f2ee9edb364bd7a4bb529c2539a571c |
Hashes for rawpy-0.2.0-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84c13c0e9a4734fe85af9d120959d31481b8a5a60b6eb5c3a36ebd2a19848058 |
|
MD5 | 8980e9f6a93990098f0e13f52f31643b |
|
BLAKE2b-256 | a27eadecbe2d4f20d499978f574ff3bbd4e643cf9a8d4b02518e3639d87fb3b0 |
Hashes for rawpy-0.2.0-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4d51966390d1422a74c0648dc9188576851cd02460289329862a02f455d74cc |
|
MD5 | 53ce16483434ca49d0510043db3d3508 |
|
BLAKE2b-256 | dcae6ec036469a14183a7c5b36f46d1231443a188e3138506df81007c46d3a98 |