Skip to main content

Python wrapper for the LibRaw library

Project description

Linux Build Status Mac OS X Build Status Windows Build Status

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.

API Documentation

Sample code

Load a RAW file and save the postprocessed image using default parameters:

import rawpy
import imageio

path = 'image.nef'
with rawpy.imread(path) as raw:
    rgb = raw.postprocess()
imageio.imsave('default.tiff', rgb)

Save as 16-bit linear image:

with rawpy.imread(path) as raw:
    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:
    with rawpy.imread(path) as raw:
        rawpy.enhance.repair_bad_pixels(raw, bad_pixels, method='median')
        rgb = raw.postprocess()
    imageio.imsave(path + '.tiff', rgb)

NumPy Dependency

Before installing rawpy, you need to have numpy installed. You can check your numpy version with pip freeze.

The minimum supported numpy version depends on your Python version:

Python

numpy

2.7

>= 1.7.1

3.4

>= 1.8.1

3.5

>= 1.9.3

You can install numpy with pip install numpy.

Installation on Windows and Mac OS X

Binaries are provided for Python 2.7, 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).

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 release version from the source repository:

git clone https://github.com/LibRaw/LibRaw.git libraw
git clone https://github.com/LibRaw/LibRaw-cmake.git libraw-cmake
cd libraw
git checkout 0.18.0
cp -R ../libraw-cmake/* .
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 (if installed manually) and apparently this folder is not searched for libraries by default in some Linux distributions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rawpy-0.8.0-cp35-cp35m-win_amd64.whl (517.8 kB view details)

Uploaded CPython 3.5mWindows x86-64

rawpy-0.8.0-cp35-cp35m-win32.whl (449.2 kB view details)

Uploaded CPython 3.5mWindows x86

rawpy-0.8.0-cp35-cp35m-macosx_10_10_intel.whl (806.3 kB view details)

Uploaded CPython 3.5mmacOS 10.10+ Intel (x86-64, i386)

rawpy-0.8.0-cp34-cp34m-win_amd64.whl (356.8 kB view details)

Uploaded CPython 3.4mWindows x86-64

rawpy-0.8.0-cp34-cp34m-win32.whl (318.4 kB view details)

Uploaded CPython 3.4mWindows x86

rawpy-0.8.0-cp34-cp34m-macosx_10_10_intel.whl (806.6 kB view details)

Uploaded CPython 3.4mmacOS 10.10+ Intel (x86-64, i386)

rawpy-0.8.0-cp27-cp27m-win_amd64.whl (383.6 kB view details)

Uploaded CPython 2.7mWindows x86-64

rawpy-0.8.0-cp27-cp27m-win32.whl (341.2 kB view details)

Uploaded CPython 2.7mWindows x86

rawpy-0.8.0-cp27-cp27m-macosx_10_10_x86_64.whl (807.0 kB view details)

Uploaded CPython 2.7mmacOS 10.10+ x86-64

File details

Details for the file rawpy-0.8.0-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 9e75c73200e80964ae0e86912e9e386df27d8164634b9d6c522515d1b8e0c64c
MD5 dab7aa6af5a3cf895e23b083aea5e9af
BLAKE2b-256 470cb2596512a39e022cae2cc2905abf78b0ac54908841314ddaec3e3697def4

See more details on using hashes here.

File details

Details for the file rawpy-0.8.0-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 e1b485c92cd02d3013fca69f2f01534bf12bf4530168674479994969b72ed984
MD5 b2cdf043b434790b3b992563f824df45
BLAKE2b-256 d6f0a2e6a34d4832b95589f4d676016d6a19a1b799bb59feca33b6f2aea11c09

See more details on using hashes here.

File details

Details for the file rawpy-0.8.0-cp35-cp35m-macosx_10_10_intel.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp35-cp35m-macosx_10_10_intel.whl
Algorithm Hash digest
SHA256 7c169350c90b88585aa3c7621c3280ec2d644fb738c320d83f5ef26ab716f2e0
MD5 29348f4529280061e70bbdc993da3079
BLAKE2b-256 caa15ac36efa34e80c598657f8bd02b0e6cfc2d4cba1f80df1b46846dfcb212a

See more details on using hashes here.

File details

Details for the file rawpy-0.8.0-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 68786d6a98eeb77b7e476b4594d2c47e861466431f29a52e820f787e44c24710
MD5 45bc88efc9bbf432bb540df8b971283a
BLAKE2b-256 e5f54e0d2fae252ce483f163a82419877ca3e2292825b37355a5873221cc4d03

See more details on using hashes here.

File details

Details for the file rawpy-0.8.0-cp34-cp34m-win32.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 1e316f585d64b04c9426ade3da5b69c64cf3fa7af0ba7cae0115d819c7c9e4a3
MD5 df510b4e64c805aff97fcf7cc800230d
BLAKE2b-256 3566be8cf54c5e383f66e7166a8446b15b0db328f2fea2cacdb811d09675f30a

See more details on using hashes here.

File details

Details for the file rawpy-0.8.0-cp34-cp34m-macosx_10_10_intel.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp34-cp34m-macosx_10_10_intel.whl
Algorithm Hash digest
SHA256 6b07ac2a7483205643a54d712e2d93c53333243043238e06c596cf4150cc81f9
MD5 79b8696b46790357fbf5a319762cfe56
BLAKE2b-256 d768ee8a8aac8f43e115e1b24791ab553ea0e325c272e2c9b037af975ed25acc

See more details on using hashes here.

File details

Details for the file rawpy-0.8.0-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 6d883d78ef6b79dc13d52b30ac4ff802dbb969285ba6fb11ba8253cf511e8590
MD5 0b0086c71a19b101224f9fb6ec5c4957
BLAKE2b-256 aaf46194a0337cc5d3f5e05ca801ce25bba687803eab2f32f929c1dfd858c061

See more details on using hashes here.

File details

Details for the file rawpy-0.8.0-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 38903931e00c2e4f2acd6310f751c4a3220ca347ed5ae36e681eb64bfe795730
MD5 c8671aef89b5e80b47ad094f854b43d6
BLAKE2b-256 f637f4302aadcbc2bc67aea0ae148b5c16a28d92b639d2d8cc20723fabf10d4b

See more details on using hashes here.

File details

Details for the file rawpy-0.8.0-cp27-cp27m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.8.0-cp27-cp27m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 5866460e0a301bd9ef6a5acd27a7130d94dee1505cef21508064c8fd42c3f172
MD5 90516b39262a17d1c4ffacc91615280f
BLAKE2b-256 ee4003c72fafa5666f1811b1b39d9bf8a214b36460c7729913117d1c5ba47a51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page