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.7.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6ff2b5d6f88bcc81aa59a6ee54f94df16828a27605c4080d7e145963b7d783f |
|
MD5 | 8e53760c79cf5fb72e03c0d7cfd7e3f8 |
|
BLAKE2b-256 | d1b2884115d2075266f74f4eb6f58709d5217df53366d1c14ec9f07b52a34e55 |
Hashes for rawpy-0.7.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8d530caedce3ab200eb2b2a87355e51a1b510d5e4dcb8be326f8653351b0543 |
|
MD5 | 346daf3e2eaa84ab0e39d1d2a7d7e7bb |
|
BLAKE2b-256 | 768584f6de6c98edacd6b38294ada7d1cb7c69615f8eef2a871598a32889a493 |
Hashes for rawpy-0.7.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 | bbfa45dea38b3750d6bdb23ebb2a8a7603ab7c8438077295116a5faff3db2744 |
|
MD5 | b4e32543ba7e43fb7a1f2bbbcd884dfb |
|
BLAKE2b-256 | 4c74c06c37c5fb7b47331ef044a0e87bf223725ef87c65268cf5b7dbb86e2b3a |
Hashes for rawpy-0.7.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7530c294fdb6a3333bc4f8e4a53970aba7df63dc761e2480e28dd0bd82b1d2c1 |
|
MD5 | 7824b06486a2c6100a2fd49e19cbe5e1 |
|
BLAKE2b-256 | 82159bcc68b51b0f3317f165131300c72737508e144c8f9b18e068b8d36eedac |
Hashes for rawpy-0.7.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4028f8e8a929900fc940708a883071559dd6574bbd57d51c12342bcfb4d2ff8b |
|
MD5 | e1e7f8a10df14e5b1f4f4a4a4421bbc5 |
|
BLAKE2b-256 | 4c5d73af1e1a612d7f7f3f409b0b27305f490c831db3a51dc9cb79d4d22295e4 |
Hashes for rawpy-0.7.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 | 7a02c5d15738f82cbd22ae4b433f8c21bf644459e2ed696eecb543afe374cce2 |
|
MD5 | 541cca7114a32cbc335e0676397eb859 |
|
BLAKE2b-256 | 321b306c303e0327f9634a0fd840a729f1f81ce44b28fe90dad7e09e5c531e53 |
Hashes for rawpy-0.7.0-cp33-cp33m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebc9c4d31902ab6ba7e7a789f9ed6b007598914bc271cd2be299c586e55319d0 |
|
MD5 | d1c530a8e2e7bdf4bd34fd36e38f2328 |
|
BLAKE2b-256 | e8cfec99606f20a51e43d18fa4baf8606705973aafbb6141e0090c6cdd02adb1 |
Hashes for rawpy-0.7.0-cp33-cp33m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3f0ec2f20dad9d24ddc05aee8b5bd87e70b92b9755d3aafef8386e88d898c91 |
|
MD5 | 088668a68add948dbbba6770e6078cb8 |
|
BLAKE2b-256 | d3b3d86b26e68fb6fbd9d0980d94bc4a14a9672416ecebbcf6d16623b9ff811b |
Hashes for rawpy-0.7.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 | 9ea9d20e8ebba423e9b4abae84a8b6900c1c1cb5f9092809a95fc60d0bb0721a |
|
MD5 | 0e23c8f2d49199798e9ff3d77602db49 |
|
BLAKE2b-256 | a07781500f5fd79e0193eeb593807328bbaadce784b15adbde4f5fd85192b2bd |
Hashes for rawpy-0.7.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27b1a8a7f41d1fba2e74e51b8dfd2a977c72007ede09e32b2505dfe154c9bdc5 |
|
MD5 | e66a4f71e2e6981c939b998e9d47d9d4 |
|
BLAKE2b-256 | 186aa02d8da20b307b4e03fac5a48ba5f461e045895c61a329529d692e7b1492 |
Hashes for rawpy-0.7.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d01e7631d344c4bf8939adb82d8ed95599c976a2b87b9fa1664b01cfeb8fc1b7 |
|
MD5 | b57dd27f950427bd1fe97a6a15e4de2b |
|
BLAKE2b-256 | 14eeb8a5aa67ca5183a9b0b58f1558eb02590f29775dab7cf41310d8a20895b4 |
Hashes for rawpy-0.7.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 | ed9c230d39ab06254fee756a89fdec945ff17249215d9ca30135cb65d0cc2781 |
|
MD5 | b2f852654954c5266805ed4a4a62f93f |
|
BLAKE2b-256 | ac4afb74660c2cbdeda7bb321648114cbc8070547be2d646391e60d0ca9605fb |