Skip to main content

RAW image processing for Python, a wrapper for libraw

Project description

Linux/macOS 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

Jupyter notebook tutorials

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.19.0
cp -R ../libraw-cmake/* .
cmake .
sudo make install

After that, install rawpy using pip install rawpy --no-binary 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

rawpy-0.12.0a1-cp36-cp36m-win_amd64.whl (531.8 kB view details)

Uploaded CPython 3.6mWindows x86-64

rawpy-0.12.0a1-cp36-cp36m-win32.whl (462.3 kB view details)

Uploaded CPython 3.6mWindows x86

rawpy-0.12.0a1-cp36-cp36m-manylinux1_x86_64.whl (675.8 kB view details)

Uploaded CPython 3.6m

rawpy-0.12.0a1-cp36-cp36m-macosx_10_10_x86_64.whl (526.1 kB view details)

Uploaded CPython 3.6mmacOS 10.10+ x86-64

rawpy-0.12.0a1-cp35-cp35m-win_amd64.whl (530.6 kB view details)

Uploaded CPython 3.5mWindows x86-64

rawpy-0.12.0a1-cp35-cp35m-win32.whl (461.6 kB view details)

Uploaded CPython 3.5mWindows x86

rawpy-0.12.0a1-cp35-cp35m-manylinux1_x86_64.whl (667.5 kB view details)

Uploaded CPython 3.5m

rawpy-0.12.0a1-cp35-cp35m-macosx_10_10_x86_64.whl (525.1 kB view details)

Uploaded CPython 3.5mmacOS 10.10+ x86-64

rawpy-0.12.0a1-cp34-cp34m-win_amd64.whl (369.1 kB view details)

Uploaded CPython 3.4mWindows x86-64

rawpy-0.12.0a1-cp34-cp34m-win32.whl (332.9 kB view details)

Uploaded CPython 3.4mWindows x86

rawpy-0.12.0a1-cp34-cp34m-manylinux1_x86_64.whl (670.8 kB view details)

Uploaded CPython 3.4m

rawpy-0.12.0a1-cp34-cp34m-macosx_10_10_x86_64.whl (524.8 kB view details)

Uploaded CPython 3.4mmacOS 10.10+ x86-64

rawpy-0.12.0a1-cp27-cp27mu-manylinux1_x86_64.whl (646.8 kB view details)

Uploaded CPython 2.7mu

rawpy-0.12.0a1-cp27-cp27m-win_amd64.whl (397.3 kB view details)

Uploaded CPython 2.7mWindows x86-64

rawpy-0.12.0a1-cp27-cp27m-win32.whl (355.0 kB view details)

Uploaded CPython 2.7mWindows x86

rawpy-0.12.0a1-cp27-cp27m-macosx_10_10_x86_64.whl (525.7 kB view details)

Uploaded CPython 2.7mmacOS 10.10+ x86-64

File details

Details for the file rawpy-0.12.0a1-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a0f73861fed0aaf5d846cd71c0fccc86ba0d6899744ba8d69d92342245d2c137
MD5 057268e326a04c9e78523a2c4f2f4d07
BLAKE2b-256 e26317db58c11f2d8741d7e8862f0df33fd8e8573201e7315bf66aa058954955

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 622b743e6de75f18999acc22aafdaeb2b41b7b15b8b4a5bea48949458a194994
MD5 738366b239a3de77c5480f6955b38880
BLAKE2b-256 113042adc450bbe65df6e6c34e377b20ced2017094019f2b29f74bd938f18af6

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c7d64447bdeb8871921e1cf42d1ee3d76f13d946bb6f931742e397af5ac5de72
MD5 1fa61b58171c99b8611b2abb2f22787b
BLAKE2b-256 f52139e7141e2600e4fcc8a18d7483dbea58ba662e3d3769bb7fbe7e864c7337

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp36-cp36m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp36-cp36m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 0529213e7f886b503fe753839eb9fe41680602e779cae15af1f540c9a3d60aee
MD5 2b4ba851047c45801f571185b36196b1
BLAKE2b-256 98498bdf5ad72db256b2857b1d815728089e22402b9ee97eb6bec6c4b1740b10

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 e79fcde20750743f3bd5ad703293b09869d891053a570e56a8cce4e8bf3d35a1
MD5 4dbd6bbb746182497a95aeeec2bfc763
BLAKE2b-256 3ba3045045c5c83a4466be1ff245fc62e9f264da684c69b97488a77dc2cd6a61

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 a80bca03eedcd1ec307f4f31a6d16c97e46ecbf4075c030455bf9c6566ba38bc
MD5 0148bda7d90001fc93a2e1d0f269e89f
BLAKE2b-256 d0696ae00036dde6f2aca909b742d3d49765de165c65906e26f949ac65b6405c

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 80518e78c54ecd541e3ea67d27d1d22b4b000de3b978f686fc2a15366ec6321a
MD5 b51772f99ccc0c8761d1367d25207c09
BLAKE2b-256 9c4eebad841e0b6f6fca37330c4dc94e95b2452358be77c0d12703e00a4b82bb

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp35-cp35m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp35-cp35m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 e0aad785d26b5e3dd988dcb2667b1231f8df63f8b52dcf304c40ad6c3749a8db
MD5 f69c63baebeb1aac78e90b93df38abd9
BLAKE2b-256 3866b58ef9bd6e614653437e060842aead0321cb6c0ba0c8e678e1658f5cc687

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 76db80743335c6c3ca1d6d5d450955b7d03960d075c5fa8c0d594a5d42e78ebb
MD5 ce1bcce690f2946056a782e52b520bfa
BLAKE2b-256 f40531292f802b70cd9d25911a658137c945f1bdfe0ff25c7a3f48ac8680f622

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp34-cp34m-win32.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 b2a173300d98f2f1902fb733b42864c4ab467eebefaa47035c0a730c1d8c8de7
MD5 24d15fe7d474edb44e5d03ce00ae0b02
BLAKE2b-256 91395fa33c9f879d9310a38eefb03315b5fc0fcb6d2e5cecfcc62ee4acb8f483

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 02032ec34473b9ef21ddb4bdc5fbb6e953c2d9a25e9309fe1dd456dbb06f6959
MD5 69bb2e6002f6e653265a4c5c955e897f
BLAKE2b-256 aa96d1e5e15cedb15deade3b2ed88840332a23308a29f77995a29f17ad7309d2

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp34-cp34m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp34-cp34m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 e110674fc0db19f81794025e47923cfe270d9ba218dee057285a47cf6a8beb6e
MD5 1d8a81b673f817abeae93b6a2b378c7f
BLAKE2b-256 56010c1f71bba2a21bac6035d79ec0f9a762887c16f5c1ba3be084e0913ae44a

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cd37ecff8219c5ec1e75945e894865bd1e310fa65af6382152633f594d311081
MD5 5d19e74a6e294d4c4ac9af26869f5cd7
BLAKE2b-256 8d3d612ddc60e0c2018095df16c8718880cd3085ad29b0830fd9ff58cebf2cac

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 65e3369bc4e6a7af6bf912547b3270c15d5c907ed988db3c62db169378aca134
MD5 2755fcf989e80463f9a64c601d1c1f70
BLAKE2b-256 24eddcec5a0018f5f71a5b7304468f7c71daf347398acf1694cd002505614bc8

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 71f73f30ffcd782c1fa105f8f10df8bc44497bd8af1a2c92da40ec209bb9e3c3
MD5 8859911a7f668673ccec3743af5d0c93
BLAKE2b-256 65dc5db53dfcc801fbca550085509d96a0fd46c0a1775f7b41c2952ced912933

See more details on using hashes here.

File details

Details for the file rawpy-0.12.0a1-cp27-cp27m-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for rawpy-0.12.0a1-cp27-cp27m-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 358935856995a603a83ce490c23335e408ffe8b3e98a4858f67e3a214f3d19df
MD5 cd7e04634973126f7552e96d5cdde553
BLAKE2b-256 7659b0554241287d66082cbc99880b698a8db11b2395807a9a8a9a8a1fb8eac6

See more details on using hashes here.

Supported by

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