Python wrapper for the LibRaw library
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.
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)
NumPy Dependency
Before installing rawpy, you need to have numpy installed. You can check your numpy version with pip freeze.
The minimum supported numpy version depends on your Python version:
Python |
numpy |
2.7 - 3.3 |
>= 1.7.1 |
3.4 |
>= 1.8.1 |
3.5 |
>= 1.9.3 |
You can install numpy with pip install numpy.
Installation on Windows and Mac OS X
Binaries are provided for Python 2.7, 3.3, 3.4 and 3.5 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).
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 git://github.com/LibRaw/LibRaw.git libraw
git clone git://github.com/LibRaw/LibRaw-cmake.git libraw-cmake
cd libraw
git checkout 0.17.1
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 and apparently this folder is not searched for libraries by default in some Linux distributions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for rawpy-0.6.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6debc8fb3222dcb422a38271517a92fac9316d39421ff87411034d780f034c1f |
|
MD5 | 3e9cfef293c4c10b75c434126911fc17 |
|
BLAKE2b-256 | d71641dcb46f5fbe4c85f39fd29c70bceebe1cba3ed93e1d72b9dee3caedb70c |
Hashes for rawpy-0.6.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f216198739432d0b35f6d8b9ecb3114103ac3a9df9a52b43021536acf262613 |
|
MD5 | 8b28817859b0a934d61b9237af810350 |
|
BLAKE2b-256 | bb8eb7c7487e74eb28f7ff6884cea95e6f4e9ecced43fb0354881309b301087b |
Hashes for rawpy-0.6.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c941b71b3c598219bc100e9f3aef646f572dcd73361bce870b24e4d44b1633d |
|
MD5 | 371c670921ff869dc93f544fabe478e5 |
|
BLAKE2b-256 | 9d82384f86d2dfd8ea7fd2799b5293001a73f8f56cc64fa0d55e52b83dba7f67 |
Hashes for rawpy-0.6.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc0c64e19d1c82078bf6aa1a410d13ac1262ef09d7efc5da6d30a7f0b1ae9634 |
|
MD5 | 916310f507880afee6baab34a8444cfe |
|
BLAKE2b-256 | 5a5355898eede1e65501abc0792d43b95144e71c101c5049d42f15b212a6be3f |
Hashes for rawpy-0.6.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f02521becca7d8edaaa33b84bfa60514ad4c18730e0e12820e9617c6adcbb28 |
|
MD5 | 8acde48d709c644da40acfe70a03a4fd |
|
BLAKE2b-256 | 60d36607852b5f9053f69e528e3de8809d5bc4adee6daa6aa6764e77f5702a8e |
Hashes for rawpy-0.6.0-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa7b367f754bd3bc11dc966adf3dbb9bf5b7806b93bf01b5a0c932ae7d29da56 |
|
MD5 | ec06dd60d3121ce886cc68f337a9e05e |
|
BLAKE2b-256 | f9b8c5ee98bf53841b4b02a305019902fe2a959d32185ce65cf833629197a748 |
Hashes for rawpy-0.6.0-cp33-cp33m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 358f61ed7af6d34281dba4bfd06a8f5be0ac5f2b8e16fd4d8acb8a0dc1e67ca1 |
|
MD5 | 76cc36043dbf7dbae368a5168b66bbdf |
|
BLAKE2b-256 | 0f9870fcafa988cf429d746bf5242be51a87cbf2faa269c20484319bf99316ff |
Hashes for rawpy-0.6.0-cp33-cp33m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef571f12cdf01a60f1020c900f7f05408f868c053ec911cf21b8a7a1a5950cba |
|
MD5 | d907523d7736f11c414b06674f39b5cb |
|
BLAKE2b-256 | 9f95f446fa874c30b34f8c86b621172175cae950e2ca3f1c1cc3d2639b5dd97c |
Hashes for rawpy-0.6.0-cp33-cp33m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55f980554ac284202954d4d396be4f6087ed097223e69fbb6f9161c49174e77f |
|
MD5 | eb343bf5489d3340d2fb847cbb1b9c42 |
|
BLAKE2b-256 | ec2da1bf351684d07e8a1f51d26e03549190a5bd599be2a51f1a2a753d7712b4 |
Hashes for rawpy-0.6.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7ca0959ba6ee258a579433b0e30b0f03f404e47cf28b14c7f44b9a27379c004 |
|
MD5 | 3cb91e09d5d87ca51cde522477b18ba5 |
|
BLAKE2b-256 | 74946098167d342e60825945acc369d824fb6ecc1ba9b2d7a39017dabd6f2ba1 |
Hashes for rawpy-0.6.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d04e9a3fb92b4edeb8cd8f9bf0edc2e5f9ef4c15d485d934ecd479ab0c23cd4 |
|
MD5 | 83a7b0805552f660d4b4a60c067c2cab |
|
BLAKE2b-256 | 00639683bcbb8a25a1820edd331c06e40b23828bde7378da579cdc76988a2767 |
Hashes for rawpy-0.6.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 242ecd8d16e1b537ae7cbfa0f227861d730262aadacefd3ebc5324a79431bfc6 |
|
MD5 | 3d0fed70f6510f170304e447d1326519 |
|
BLAKE2b-256 | 954ab91edf1c79c5e88b4ca351547ad2dc7c3082c32a4c8433bd48125e2e0ffb |