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 |
>= 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.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 https://github.com/LibRaw/LibRaw.git libraw
git clone https://github.com/LibRaw/LibRaw-cmake.git libraw-cmake
cd libraw
git checkout 0.18.0
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 (if installed manually) 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rawpy-0.8.1-cp35-cp35m-win_amd64.whl.
File metadata
- Download URL: rawpy-0.8.1-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 517.8 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6ecf2fef0cee4e78b3695f6dde02f1d6a9ed023f22c2b2a5718c450d9b26fa0
|
|
| MD5 |
21c369e24be38c6d47618608141896d1
|
|
| BLAKE2b-256 |
30b00104866c887717e9c16c6f6dc401760a941cca0a403bf97238002ef4df2f
|
File details
Details for the file rawpy-0.8.1-cp35-cp35m-win32.whl.
File metadata
- Download URL: rawpy-0.8.1-cp35-cp35m-win32.whl
- Upload date:
- Size: 449.2 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69edc199fcdeb856038d66473b325361bb166d53a4e5a1531cfca93e32de2cd0
|
|
| MD5 |
a3f2b7cc5d542269f5d04a469f700040
|
|
| BLAKE2b-256 |
4e06206d3cb3d3a65060efe4b6004af6032b6a08685e0ab562594f9271b0a161
|
File details
Details for the file rawpy-0.8.1-cp35-cp35m-macosx_10_10_intel.whl.
File metadata
- Download URL: rawpy-0.8.1-cp35-cp35m-macosx_10_10_intel.whl
- Upload date:
- Size: 983.3 kB
- Tags: CPython 3.5m, macOS 10.10+ Intel (x86-64, i386)
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88c14915b81988b7627a291548036ad914254ff265e4d105ac61195d16e95ca2
|
|
| MD5 |
41073090e7596b9db1f6799c2958d067
|
|
| BLAKE2b-256 |
1d3e4351cea0a31e3278b755ad7df4a1cc581bafe7e95be7441d3f0f64a3ab43
|
File details
Details for the file rawpy-0.8.1-cp34-cp34m-win_amd64.whl.
File metadata
- Download URL: rawpy-0.8.1-cp34-cp34m-win_amd64.whl
- Upload date:
- Size: 356.7 kB
- Tags: CPython 3.4m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e9cd5b6e4436736f7473f347f9968d3f25ce71ace0fa2128e1f6c1ed562e87
|
|
| MD5 |
9ced14742d54360d92da4c2b342cbfae
|
|
| BLAKE2b-256 |
2ffd5ac45bb23e2c5192eb73ef873774e601fd88bed9c3328f69b28ebce8d1a8
|
File details
Details for the file rawpy-0.8.1-cp34-cp34m-win32.whl.
File metadata
- Download URL: rawpy-0.8.1-cp34-cp34m-win32.whl
- Upload date:
- Size: 318.4 kB
- Tags: CPython 3.4m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53590cfa269c9d7ac0e9f39e7fd8894db385ea04e6b84a0bbe11491e34dc828a
|
|
| MD5 |
e3ce213cb950daf169a9a393ba77cbb2
|
|
| BLAKE2b-256 |
5582a44c24d5f360a28b5c6f84ac8cb114855a591fe43a5a00441e5f22775f70
|
File details
Details for the file rawpy-0.8.1-cp34-cp34m-macosx_10_10_intel.whl.
File metadata
- Download URL: rawpy-0.8.1-cp34-cp34m-macosx_10_10_intel.whl
- Upload date:
- Size: 983.5 kB
- Tags: CPython 3.4m, macOS 10.10+ Intel (x86-64, i386)
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55315af829ef45a5ca4ee9e405a8cd595d149691e21ac17fcf5bf1f31afee3c9
|
|
| MD5 |
8d8972c60a70f405f04a8695cfb3e2d4
|
|
| BLAKE2b-256 |
fb7543fdeb28133a8d29783847a5c38575f114da0e17f1c553ff794b9c4ffc15
|
File details
Details for the file rawpy-0.8.1-cp27-cp27m-win_amd64.whl.
File metadata
- Download URL: rawpy-0.8.1-cp27-cp27m-win_amd64.whl
- Upload date:
- Size: 383.6 kB
- Tags: CPython 2.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e9fd3b02f05b94260a73d44120e9cca13f2786c248cd434a6526c8c7e416aa8
|
|
| MD5 |
cecad4972840ebb427b8d7c06c3bfb07
|
|
| BLAKE2b-256 |
d5ea3c652cc05e7e89820b28e9c17993ca789c40cef22d3692937ad77ceaaa1b
|
File details
Details for the file rawpy-0.8.1-cp27-cp27m-win32.whl.
File metadata
- Download URL: rawpy-0.8.1-cp27-cp27m-win32.whl
- Upload date:
- Size: 341.2 kB
- Tags: CPython 2.7m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a357e8ecfb3aca187530982dcb5c6106bc037f0650046fcb5ee37a9b1842a09
|
|
| MD5 |
6b5528aa3c7525b5d9626d5f8f7f8845
|
|
| BLAKE2b-256 |
9749e52b7235bd124e04ca15f933fce67fd851feefb03eb17107c600c411cbac
|
File details
Details for the file rawpy-0.8.1-cp27-cp27m-macosx_10_10_x86_64.whl.
File metadata
- Download URL: rawpy-0.8.1-cp27-cp27m-macosx_10_10_x86_64.whl
- Upload date:
- Size: 984.0 kB
- Tags: CPython 2.7m, macOS 10.10+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
313a13e3b8faa63bcf7876b8d05a93b59005c02a573d3f7366358c8965d5e835
|
|
| MD5 |
b929732c697f7ad99ae5aacd0c14fb8a
|
|
| BLAKE2b-256 |
0f2830534f6bb96d9c9f58741d6f10feee44cbe797ccc908db94c14dc99db0d9
|