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'
raw = rawpy.imread(path)
rgb = raw.postprocess()
imageio.imsave('default.tiff', rgb)
Save as 16-bit linear image:
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:
raw = rawpy.imread(path)
rawpy.enhance.repair_bad_pixels(raw, bad_pixels, method='median')
rgb = raw.postprocess()
imageio.imsave(path + '.tiff', rgb)
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 developer version from the SVN repository:
git clone git://github.com/LibRaw/LibRaw.git libraw
git clone git://github.com/LibRaw/LibRaw-cmake.git libraw-cmake
cp -R libraw-cmake/* libraw ;
cd libraw
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.
Installation on Windows and Mac OS X
Binaries are provided for Python 2.7, 3.3 and 3.4 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).
Binaries for other Python versions are currently not produced but if there is a need then this is possible as well. In that case, just contact me.
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.4.0-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca0bfc3eb410b9208af02e76fa7e59b9ad073bb9094cf88d5dc021fe3b019aeb |
|
MD5 | 12987b02ca324d75615028bd0bfc8459 |
|
BLAKE2b-256 | 9b00701a0e1264c565e05ddb273ca39a2acab04d07497c48cef3ffafc7ad3c0d |
Hashes for rawpy-0.4.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 | e68c9697bf5c3c23249da04114ca424c9b5ac2efd86d5838b21522ef6b0c5726 |
|
MD5 | 57a4433a8da951200b5af56977e991db |
|
BLAKE2b-256 | edd2792da270263e5997dd7185688e86fa844d66c520504805a6c19b1a17715f |
Hashes for rawpy-0.4.0-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 843cb55c3c0b705eda307071bce104a5988dedcdd113cbf5d6d198baa3a8df21 |
|
MD5 | c81925a6fafd951d37f0988b38a42575 |
|
BLAKE2b-256 | 1697eb1d2b829950f8b162a314233210de8ffadde5898c7de0d96e870991d6b7 |
Hashes for rawpy-0.4.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 | 6e4970b6532f97a2a89dad715602bdf8a96a78b74f8a70b064826093585da5d2 |
|
MD5 | 02d72b6451aabcd95df8128dd7831a44 |
|
BLAKE2b-256 | 142168957207a80e2876402feeff1c3a0a00abe421b84f34a1a5a3a5794d3e54 |
Hashes for rawpy-0.4.0-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce6cdf91a4b219b83808c7baa758a4f20ccba508579821904a26cc69b2e46fc2 |
|
MD5 | eb5d652c9fa8e0c2e8b1128ecd16c109 |
|
BLAKE2b-256 | ca80160af30375ea94e9502667671c01c6001910259a3c2a154b182246c5cbfc |
Hashes for rawpy-0.4.0-cp27-none-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 | 5a2b3ea236a8759d7db6183a3794427738f6c1f71366f27fdd47d4be71b6d4d0 |
|
MD5 | 3d9708f1828758e2e79c55d52af936d1 |
|
BLAKE2b-256 | ce6fd99ca6966240db870ff02f8b574ebcb619b0af88383ca89c7c0069ffdc0e |