Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

RAW image processing for Python, a wrapper for libraw

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.

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

Binary wheels for Linux, macOS, and Windows are provided for Python 2.7, 3.4, 3.5, and 3.6. These can be installed with a simple pip install rawpy. Currently, Linux and macOS wheels are only available as 64 bit versions.

Installation from source on Linux/macOS

If you have the need to use a specific libraw version or you can’t use the provided binary wheels then follow the steps in this section to build rawpy from source.

First, install the LibRaw library on your system.

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, install rawpy using pip install rawpy --no-binary :all:.

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
Release History

Release History

This version
History Node

0.10.1

History Node

0.10.0

History Node

0.10.0a1

History Node

0.9.0

History Node

0.8.1

History Node

0.8.0

History Node

0.7.0

History Node

0.6.0

History Node

0.5.1

History Node

0.5.0

History Node

0.4.0

History Node

0.3.5

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.0

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
rawpy-0.10.1-cp27-cp27m-macosx_10_10_x86_64.whl (509.0 kB) Copy SHA256 Checksum SHA256 cp27 Wheel Jul 28, 2017
rawpy-0.10.1-cp27-cp27mu-manylinux1_x86_64.whl (620.3 kB) Copy SHA256 Checksum SHA256 cp27 Wheel Jul 28, 2017
rawpy-0.10.1-cp27-cp27m-win32.whl (342.8 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jul 28, 2017
rawpy-0.10.1-cp27-cp27m-win_amd64.whl (385.7 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jul 28, 2017
rawpy-0.10.1-cp34-cp34m-macosx_10_10_x86_64.whl (508.7 kB) Copy SHA256 Checksum SHA256 cp34 Wheel Jul 28, 2017
rawpy-0.10.1-cp34-cp34m-manylinux1_x86_64.whl (653.2 kB) Copy SHA256 Checksum SHA256 cp34 Wheel Jul 28, 2017
rawpy-0.10.1-cp34-cp34m-win32.whl (318.7 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Jul 28, 2017
rawpy-0.10.1-cp34-cp34m-win_amd64.whl (357.1 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Jul 28, 2017
rawpy-0.10.1-cp35-cp35m-macosx_10_10_x86_64.whl (508.5 kB) Copy SHA256 Checksum SHA256 cp35 Wheel Jul 28, 2017
rawpy-0.10.1-cp35-cp35m-manylinux1_x86_64.whl (650.9 kB) Copy SHA256 Checksum SHA256 cp35 Wheel Jul 28, 2017
rawpy-0.10.1-cp35-cp35m-win32.whl (450.9 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Jul 28, 2017
rawpy-0.10.1-cp35-cp35m-win_amd64.whl (520.0 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Jul 28, 2017
rawpy-0.10.1-cp36-cp36m-macosx_10_10_x86_64.whl (509.9 kB) Copy SHA256 Checksum SHA256 cp36 Wheel Jul 28, 2017
rawpy-0.10.1-cp36-cp36m-manylinux1_x86_64.whl (656.2 kB) Copy SHA256 Checksum SHA256 cp36 Wheel Jul 28, 2017
rawpy-0.10.1-cp36-cp36m-win32.whl (451.7 kB) Copy SHA256 Checksum SHA256 3.6 Wheel Jul 28, 2017
rawpy-0.10.1-cp36-cp36m-win_amd64.whl (520.6 kB) Copy SHA256 Checksum SHA256 3.6 Wheel Jul 28, 2017
rawpy-0.10.1.tar.gz (107.3 kB) Copy SHA256 Checksum SHA256 Source Jul 28, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting