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.

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


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.3.2-cp34-none-win_amd64.whl (447.6 kB view details)

Uploaded CPython 3.4Windows x86-64

rawpy-0.3.2-cp34-none-win32.whl (407.0 kB view details)

Uploaded CPython 3.4Windows x86

rawpy-0.3.2-cp33-none-win_amd64.whl (447.6 kB view details)

Uploaded CPython 3.3Windows x86-64

rawpy-0.3.2-cp33-none-win32.whl (406.9 kB view details)

Uploaded CPython 3.3Windows x86

rawpy-0.3.2-cp27-none-win_amd64.whl (472.3 kB view details)

Uploaded CPython 2.7Windows x86-64

rawpy-0.3.2-cp27-none-win32.whl (430.4 kB view details)

Uploaded CPython 2.7Windows x86

File details

Details for the file rawpy-0.3.2-cp34-none-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.3.2-cp34-none-win_amd64.whl
Algorithm Hash digest
SHA256 851959583f3473b3467197be86101d3030baa170da737ca7797c8aa0ef5ca8b5
MD5 6394eac3e11e689b74a8e714f18a2326
BLAKE2b-256 7dc3c593140f7b52884de6efffd00e91646a3033eb87113ec25ce0057dfbedc7

See more details on using hashes here.

File details

Details for the file rawpy-0.3.2-cp34-none-win32.whl.

File metadata

  • Download URL: rawpy-0.3.2-cp34-none-win32.whl
  • Upload date:
  • Size: 407.0 kB
  • Tags: CPython 3.4, Windows x86
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rawpy-0.3.2-cp34-none-win32.whl
Algorithm Hash digest
SHA256 abf68c650c422caced39101529d79c4065a4922ef325da9b193c4baba86655f7
MD5 f1fc4676d5c480edf3548d123766c19f
BLAKE2b-256 2aed8c2cd2de911dd87e992bb7b05c3b620db109ffae3bbad180d36dcfbedc63

See more details on using hashes here.

File details

Details for the file rawpy-0.3.2-cp33-none-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.3.2-cp33-none-win_amd64.whl
Algorithm Hash digest
SHA256 f9371262e756b6d9641ff7c5d0ad540081f739a4ce2c45ae2065c44acf141f36
MD5 d11b57c1b6d2bc35332de518a6eb41b5
BLAKE2b-256 0216a497736c26c1789ef1f25a0296776965fa16363bdabef47f342e97359d05

See more details on using hashes here.

File details

Details for the file rawpy-0.3.2-cp33-none-win32.whl.

File metadata

  • Download URL: rawpy-0.3.2-cp33-none-win32.whl
  • Upload date:
  • Size: 406.9 kB
  • Tags: CPython 3.3, Windows x86
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rawpy-0.3.2-cp33-none-win32.whl
Algorithm Hash digest
SHA256 ee6688f3148b2fe3d86d9f455684ec0c95a5014c2abcf9ce71a6098bc1cbc9b6
MD5 eb62081b49e82a2ddff2f93d92f4b743
BLAKE2b-256 af169b535b7b01b8c8e9b8279060ca0d27c42ed2a2736db5ef201b8baa766a50

See more details on using hashes here.

File details

Details for the file rawpy-0.3.2-cp27-none-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.3.2-cp27-none-win_amd64.whl
Algorithm Hash digest
SHA256 b51f446ea6527a03ae8045707f7bb4a9accc0cae2ef399a6c9188391d3d5a3ed
MD5 48e1bea297b089157acc4bbd7b97533c
BLAKE2b-256 edb03d83321cb4cc7ce2836798279b2b1ac02e1cba185600c49dc5c2913fa9e7

See more details on using hashes here.

File details

Details for the file rawpy-0.3.2-cp27-none-win32.whl.

File metadata

  • Download URL: rawpy-0.3.2-cp27-none-win32.whl
  • Upload date:
  • Size: 430.4 kB
  • Tags: CPython 2.7, Windows x86
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rawpy-0.3.2-cp27-none-win32.whl
Algorithm Hash digest
SHA256 502492e7aebbaed12526bb27d5eebce866fa0b2350d96e4511c5305629043310
MD5 e5fe2eb76fcba7f948c6dce59364262c
BLAKE2b-256 93a8f85052824f1b342c10f6ff94aa5a41169f86cdfa7f9c525577ce9a1e990c

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