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.3.4-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d59f4f3ac73034bb2f3a39377c03cc638cd0733949672ca1fb804dd5a83b14a |
|
MD5 | c611e722c8cbb66079e2c1a525e6b173 |
|
BLAKE2b-256 | 700b02435a1b9ca12723135282ab7578d87dc8e731ae9b3eea00d73a6e3dece3 |
Hashes for rawpy-0.3.4-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 | 73b0419fed37e4e8a665e196de607c49d469c1c4ed9c2bc4de5345d3cc461942 |
|
MD5 | e5febc2fc8a2ce1b201588b943a6f938 |
|
BLAKE2b-256 | 0fd7c63a13df51340d4c5f8b9b03040120e1f3370f13ce5b244719daa841d873 |
Hashes for rawpy-0.3.4-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05ecd2e079af0b75bef79dd9259901d64e1a7713a5aba180357431be9ba1967d |
|
MD5 | 7025333352dd34d98ad5b7129ca85efd |
|
BLAKE2b-256 | bbb8c2591f855cf786faf4f6511d8f695002970e2d9caab6087e01f9b51495b4 |
Hashes for rawpy-0.3.4-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 | fe531bb85561435373acb826b6b684120595ac753d5ff8925b73d85f807d1d30 |
|
MD5 | 516043b99b83ee3d7f00788349749cb4 |
|
BLAKE2b-256 | 1c2e6fa47eb1783c430e536602e5ad7a8550034e0c065f8d23ac49e19273da7b |
Hashes for rawpy-0.3.4-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 494353d883f0967e467281d6758449eb601cf6670f0b5684bf715337e61ad83a |
|
MD5 | ad08f725920befb57d033b0d8b876546 |
|
BLAKE2b-256 | 936e8285b206ce137fb21c3ea93c8334aac8b8f53506cbf20751bcc269e2575d |
Hashes for rawpy-0.3.4-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 | 860a120f5ed8f88256bcd9ec011a81208400342289e3cb2133455f508d4f4667 |
|
MD5 | e62316e2dfa7e97242a651c77a3ece34 |
|
BLAKE2b-256 | 4669e4bca90a82a219d290f4dd5b8b5b810eb2019236839e006a4c23a118f288 |