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)

Installation on Windows and macOS

Binaries are provided for Python 2.7, 3.4, 3.5, and 3.6. These can be installed with a simple pip install rawpy (or pip install --use-wheel 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.2
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.

NumPy Dependency

rawpy depends on NumPy. The minimum supported NumPy version depends on your Python version:

Python

NumPy

2.7

>= 1.7

3.4

>= 1.8

3.5

>= 1.9

3.6

>= 1.11

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.9.0-cp36-cp36m-win_amd64.whl (518.7 kB view details)

Uploaded CPython 3.6mWindows x86-64

rawpy-0.9.0-cp36-cp36m-win32.whl (450.1 kB view details)

Uploaded CPython 3.6mWindows x86

rawpy-0.9.0-cp36-cp36m-macosx_10_10_x86_64.whl (499.3 kB view details)

Uploaded CPython 3.6mmacOS 10.10+ x86-64

rawpy-0.9.0-cp35-cp35m-win_amd64.whl (517.9 kB view details)

Uploaded CPython 3.5mWindows x86-64

rawpy-0.9.0-cp35-cp35m-win32.whl (449.4 kB view details)

Uploaded CPython 3.5mWindows x86

rawpy-0.9.0-cp35-cp35m-macosx_10_10_x86_64.whl (497.8 kB view details)

Uploaded CPython 3.5mmacOS 10.10+ x86-64

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

Uploaded CPython 3.4mWindows x86-64

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

Uploaded CPython 3.4mWindows x86

rawpy-0.9.0-cp34-cp34m-macosx_10_10_x86_64.whl (498.1 kB view details)

Uploaded CPython 3.4mmacOS 10.10+ x86-64

rawpy-0.9.0-cp27-cp27m-win_amd64.whl (383.7 kB view details)

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7mWindows x86

rawpy-0.9.0-cp27-cp27m-macosx_10_10_x86_64.whl (498.3 kB view details)

Uploaded CPython 2.7mmacOS 10.10+ x86-64

File details

Details for the file rawpy-0.9.0-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.9.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 5a25dd0b8814423bd07613700e543d4b7eb0f1fd2c20f4dafb2cc41d1891795f
MD5 da547046af3853001f367de9db27c4ea
BLAKE2b-256 f7004b929082e5fe887250f1f6cbe2bbc61e8fa8e828c0a9155ab0385c9df2d5

See more details on using hashes here.

File details

Details for the file rawpy-0.9.0-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for rawpy-0.9.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 301f573857312e89522a5e50078d56d9384d0aa1e4690c5617f5913cb06a821d
MD5 17b2105535fa842ccd90e659963ba6d1
BLAKE2b-256 78940cc061c86d349eb32680940db7ba336260134a084a990b88f93a8e3f40b3

See more details on using hashes here.

File details

Details for the file rawpy-0.9.0-cp36-cp36m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.9.0-cp36-cp36m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 a3b878bfa1338f45bb2b106d5c0ae22b33d0f38fe3d50d2725f9901b7def8cc9
MD5 f0cf86d6a7ea08826988b9c15b41f543
BLAKE2b-256 4ea8993fe4298e40f81db576bf3443bf67c6c741e50d1354fac9530716adb2d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rawpy-0.9.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 b02a95edab2cf12c32f346582c580c93510db6742df83277752576f0999d4f71
MD5 6409a230485d52771109c8aeb5eeae43
BLAKE2b-256 8c9682a1353fb1a7f8d1c8db83d518d15e3663596d59b4f3eac806dd91517ad0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rawpy-0.9.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 9eccdbad234c24f477d239fd1e4d6eddf3d6cf297ce271495bac5275d21927be
MD5 2142dffe454c7a6e8268cc27e5bd1046
BLAKE2b-256 3566a5aa1a901c669c700772ff547816dbf9e06d336a6d29736b7c9a2461c5f5

See more details on using hashes here.

File details

Details for the file rawpy-0.9.0-cp35-cp35m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.9.0-cp35-cp35m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 d8f52df19e16de5a1842c26eb77876a70c66c27cd31f9dd1d5bf09790750b591
MD5 ab2976e2847b5087c2afdb506d014d0b
BLAKE2b-256 8ddf26d4d2a5335353e32f8d12513d8f8eb080d8ea7327ede3f788023e34746a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rawpy-0.9.0-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 83e0cf8a5c3dd9aa4372576fb5bd1578d77c7d77c1dfdb05d1b764058026ae61
MD5 2459399b92fcb0a98b2c60b5c8017d0c
BLAKE2b-256 8e0048bea1d248bce604cbb18e6e88561e65aaa8158092fca5c7680863c4af43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rawpy-0.9.0-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 ec2339103b4d3f81ed31a7f6f49711aba05db093b8081f61920f5afd4c66e2ab
MD5 f9caa7a00a002cd763d047ccc037d137
BLAKE2b-256 f5c6e9a4f5ad472355f66d7331bd58a6c84c16d2006a3c5675eca84117227c9a

See more details on using hashes here.

File details

Details for the file rawpy-0.9.0-cp34-cp34m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.9.0-cp34-cp34m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 09717e015ccf448761f3b184aa12604a0cb43a450d7c7709787ecf64ad555c23
MD5 0d9a38cb6532600c662a93ab16b3fe9b
BLAKE2b-256 dea0cf78d0f2a66f1c4647e53681ce25a5596566c61b283a8ffc38f384f48b23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rawpy-0.9.0-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 3c904ef81166c5d2eb4e516af7fa44b9717a97815da397367706a8c6c83cccdf
MD5 ee0592900836e748a43f72c06b5ab21e
BLAKE2b-256 70991b4c7bd82e69d9f84dcb7483d0c488dcc061ecc8e93d184f4c535a25784c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rawpy-0.9.0-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 70c3e06193f2c548e1b14da0cc73b64f6d37335c3f74bae29faf7b4604252f2e
MD5 c365d9feb67cb362bd56d0eae938a0b4
BLAKE2b-256 8062245a073e5afc79991241546de0a8b32cfbe685d2469bc8bf8f7bb24baf56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rawpy-0.9.0-cp27-cp27m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 79d7bc9f838714cc9f0c6b377f7da5ed82fbe0cb26505bc3f81fe4757305077b
MD5 3372d5b75cdbeb26e01c7ef8c1263db9
BLAKE2b-256 0eb0bc615af869f3f671120837ff578b3763e1f00a40abf1813261a073025b8c

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