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 3.5, 3.6, and 3.7. These can be installed with a simple pip install rawpy. Currently, Linux and macOS wheels are only available as 64 bit versions.

The underlying LibRaw library supports several optional features. The following table shows which PyPI binary wheels support which features.

Feature

Windows

macOS

Linux

LCMS color engine

no

yes

yes

RedCine codec

no

yes

yes

DNG deflate codec

yes

yes

yes

DNG lossy codec

yes

yes

yes

Demosaic Pack GPL2

no

no

no

Demosaic Pack GPL3

no

no

no

OpenMP

yes

no

yes

Tip: You can dynamically query supported features by inspecting the rawpy.flags dictionary.

Note on Windows features: The LCMS color engine and RedCine codec features are currently not supported as the automated build process to generate wheels relies on Anaconda to supply any needed library dependencies. For RedCine codec support, the Windows variant of the Jasper library is missing, and for LCMS color engine support, the LCMS library is missing.

Note on GPL demosaic packs: The GPL2 and GPL3 demosaic packs are not included as rawpy is licensed under the MIT license which is incompatible with GPL.

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

After that, install rawpy using:

git clone https://github.com/letmaik/rawpy
cd rawpy
pip install numpy cython
pip install .

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

3.5

>= 1.9

3.6

>= 1.11

3.7

>= 1.14

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.14.0a1-cp37-cp37m-win_amd64.whl (464.8 kB view details)

Uploaded CPython 3.7mWindows x86-64

rawpy-0.14.0a1-cp37-cp37m-win32.whl (412.4 kB view details)

Uploaded CPython 3.7mWindows x86

rawpy-0.14.0a1-cp37-cp37m-manylinux2010_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

rawpy-0.14.0a1-cp37-cp37m-macosx_10_9_x86_64.whl (953.0 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

rawpy-0.14.0a1-cp36-cp36m-win_amd64.whl (464.7 kB view details)

Uploaded CPython 3.6mWindows x86-64

rawpy-0.14.0a1-cp36-cp36m-win32.whl (412.4 kB view details)

Uploaded CPython 3.6mWindows x86

rawpy-0.14.0a1-cp36-cp36m-manylinux2010_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

rawpy-0.14.0a1-cp36-cp36m-macosx_10_9_x86_64.whl (955.2 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

rawpy-0.14.0a1-cp35-cp35m-win_amd64.whl (539.1 kB view details)

Uploaded CPython 3.5mWindows x86-64

rawpy-0.14.0a1-cp35-cp35m-win32.whl (467.6 kB view details)

Uploaded CPython 3.5mWindows x86

rawpy-0.14.0a1-cp35-cp35m-manylinux2010_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.5mmanylinux: glibc 2.12+ x86-64

rawpy-0.14.0a1-cp35-cp35m-macosx_10_6_intel.whl (944.8 kB view details)

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

File details

Details for the file rawpy-0.14.0a1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: rawpy-0.14.0a1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 464.8 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 2927d6b00df9db2a0f224ad4190803a84079285c10b08421e0c57e6c48597d7d
MD5 e8906d145f1a1cf2c8dccb0dd504e632
BLAKE2b-256 8d070715e419ff061ec0b217d1bb51eef44d70c3edb882935f6d912afb4d147e

See more details on using hashes here.

File details

Details for the file rawpy-0.14.0a1-cp37-cp37m-win32.whl.

File metadata

  • Download URL: rawpy-0.14.0a1-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 412.4 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 b5b642a6e0c09cb19470b7ee62b10c8aa57bac74f06cce61fc61b902754e46b5
MD5 8d9b1d5b11b9914aad124f36b350aff8
BLAKE2b-256 2de379829dc15a90d37e55b70bf8a8d14bb182912fd274d0cb8328d6f669397e

See more details on using hashes here.

File details

Details for the file rawpy-0.14.0a1-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: rawpy-0.14.0a1-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 060aff03e65015477d78af3ea4980d313a5b7f1733256159dd3720ff5e493a93
MD5 e938810bed4d242ed4a8c57f81efda20
BLAKE2b-256 05ec96cc32c177f82c8a3363f9f419b2505cdc49ff679884d413b4c5a933340d

See more details on using hashes here.

File details

Details for the file rawpy-0.14.0a1-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: rawpy-0.14.0a1-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 953.0 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 41dd9bee62c23c3b689948023f859fa5d95c0509747b979af352c8d0ebc99e1c
MD5 10b26f284801dc1fb7f004810dc9cb62
BLAKE2b-256 372d877837ba565ef4e608de9521011111765d820697b7ca13f25c15d7652b23

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rawpy-0.14.0a1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 464.7 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 00e742805c64fde66155eccfd61c6fabdd858b67d4c7a6e96f062ace186e7fd4
MD5 21bb02aaa7d549343a6de961a902d505
BLAKE2b-256 16c218179f638062e9a9b4c744a974bb44192fa0537cd6e192bf55352d4a6fdd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rawpy-0.14.0a1-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 412.4 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 ab7391f149042718ed02b572d7e1f131b445e4dacea59c4f51f6a90cb8228324
MD5 cb3ba546273df5239e2cef589262887d
BLAKE2b-256 14f71d85486a6636ebd905075bb60a05b1c924a7c1afb11b22d9a8ab59fd9339

See more details on using hashes here.

File details

Details for the file rawpy-0.14.0a1-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: rawpy-0.14.0a1-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6eab82eeefb2e8440d07faae47ff50c3ce95b4fe082d7cb1660b4bb6637aac04
MD5 11aaafa414d1d17b3e6f537d0ea52979
BLAKE2b-256 b8df7083f65a55b06a752ce989d5726edb9b2a6b411c0ad48fc519cb7579b17e

See more details on using hashes here.

File details

Details for the file rawpy-0.14.0a1-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: rawpy-0.14.0a1-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 955.2 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9adda3a206080b3fd80f19ebb605fef76c0cdcf975a2416735ce9b8d4767e209
MD5 6ec9561ea2df40fbdd4eb132595cd635
BLAKE2b-256 eb34eff3762ec855f17eca4c67146c088b81e126b78c9e714835d65113b3ac8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rawpy-0.14.0a1-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 539.1 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 f2f10dd6dc4b3dc5751a60329bea70fb21b426fe9ddfd8adf63701d523d79e8d
MD5 60362818f5a1dd9b2e46de5d897fdbb2
BLAKE2b-256 af01f812eb334675a9b3bb75079c93d898668aa05fe759fb4e99c8b7e12a28a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rawpy-0.14.0a1-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 467.6 kB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 4ac1dfc79b484a1be714451aa7e5d257ff293e80424415a578d15e444f8523fb
MD5 1c9af3968b00ed3a7ecb544204b28409
BLAKE2b-256 0ab8bdb6adc61a07bf2317cd55546fde04f7e44589eb7dca5ab9acaef3b5abc7

See more details on using hashes here.

File details

Details for the file rawpy-0.14.0a1-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: rawpy-0.14.0a1-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 685fcb4f641ae7a60df830645f9e8393c378cc6fe483296665a75cbbf4db8e56
MD5 4a1bbb3a1dc0b6637577e8ccd6a9d2b7
BLAKE2b-256 dcc4ec9cb733b112ccda792801efcce6727305efa4e83e80259e6c2d6b5dc826

See more details on using hashes here.

File details

Details for the file rawpy-0.14.0a1-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

  • Download URL: rawpy-0.14.0a1-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 944.8 kB
  • Tags: CPython 3.5m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for rawpy-0.14.0a1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 7c3e84fae496430a3cc150d1b5cee14f0719dc9375148231ebb091332cc0a91b
MD5 a8e88ce366663a39cdc7e648c6794248
BLAKE2b-256 9cc91a6d8ca8c698a15c803d15106acaa57f070a8275c506a7bda048b17c09d5

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