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)
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 developer 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
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.
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.5.1-cp35-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ca2175a82a8f45c1aaa14c114851d4335ac3ee3ff4c4a05a91e6682f6ea7b9a |
|
MD5 | 2efd3e5ed2d7629bc2fb728b6d6d7958 |
|
BLAKE2b-256 | 29fc81471cc0501f4c3ed49241c3cce4de71c95bb13e23f04321d36665b7d07b |
Hashes for rawpy-0.5.1-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 | a87df465d505951beaff4a6612c37dec75c79ff95faa2d98a8141eaa5cd89b01 |
|
MD5 | 2767ee2b96f2a837753f2f3e8c51b254 |
|
BLAKE2b-256 | 1e23b9ba8a4bf43c5b6906ac9c305e17aa2f12f574f8c2cc65666c39c4ff8037 |
Hashes for rawpy-0.5.1-cp34-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78bcfcfaa0c4cdcff0176d037443031a272c781109f8c79858930ee07553ae35 |
|
MD5 | 92759d6bdbd9d600c9b22aa4e54ad066 |
|
BLAKE2b-256 | 8bf31cfc2abd48eafebcf759d1f1d5b5c3eaa7a32ff85da22123b627df0dc7eb |
Hashes for rawpy-0.5.1-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 | d6bed46e1ec9ca05c8681ab2d8a8144688b1d5f1a88dc6370c2d4f98a965cc0e |
|
MD5 | d212f57189b5e2cdc1d680d3cbd1db73 |
|
BLAKE2b-256 | 36b832bc5f8272e08e6281cb3ee3bdfdf2b73c55e218ffd69d77afde1b7d3aa3 |
Hashes for rawpy-0.5.1-cp33-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c7ea5aaf70e70872378eb2aacd426161f05da5161f7febd05701bb8e940676a |
|
MD5 | c609c06b33e48bc1a6afa725e24c4667 |
|
BLAKE2b-256 | b2ebbd723646abe5fcf797a699c1be99af693485cc264ce6a4bcfb29d70ae395 |
Hashes for rawpy-0.5.1-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 | b7af2e87fb45cdf364d5855ae22b3ba705107259fd82abeb543830995c705705 |
|
MD5 | 63096ef69242713fdefa64282cb970e7 |
|
BLAKE2b-256 | 50b4668f97d90cb7964938cee63a1032c21e15136b50bf5ce469a81686df114e |
Hashes for rawpy-0.5.1-cp27-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc5982faf87bb71c5d30489c10637ed6c97534e1137c0f6018c7acd39e15e1f0 |
|
MD5 | e35cec4f1b894246e1e09d84a7b3cdb5 |
|
BLAKE2b-256 | 0494d94f275281a51074cd577b78cc2b06ec9fd1112aa908ee5f2bb56e1f5dda |
Hashes for rawpy-0.5.1-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 | e6d075d3137fdc253b3931c18cfc91640e5516abe3e3559c8a6c3fb66a4d5266 |
|
MD5 | 44ee57fce4e5495a642948d88b023afb |
|
BLAKE2b-256 | 87c5c8578f26c7f4813d758408b25403e8239b4ae80aeed5a9fefb60a9273590 |