RAW image processing for Python, a wrapper for libraw
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)
Extract embedded thumbnail/preview image and save as JPEG:
with rawpy.imread(path) as raw:
# raises rawpy.LibRawNoThumbnailError if thumbnail missing
# raises rawpy.LibRawUnsupportedThumbnailError if unsupported format
thumb = raw.extract_thumb()
if thumb.format == rawpy.ThumbFormat.JPEG:
# thumb.data is already in JPEG format, save as-is
with open('thumb.jpeg', 'wb') as f:
f.write(thumb.data)
elif thumb.format == rawpy.ThumbFormat.BITMAP:
# thumb.data is an RGB numpy array, convert with imageio
imageio.imsave('thumb.jpeg', thumb.data)
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)
Installation
Install rawpy by running:
pip install rawpy
64-bit binary wheels are provided for Linux, macOS, and Windows.
Stable vs. pre-release
All stable rawpy releases are always built against a stable LibRaw library release.
You can output the LibRaw version with print(rawpy.libraw_version)
.
rawpy pre-releases have version numbers like 0.15.0a1
and are built against
a recent LibRaw snapshot. To install a pre-release, run:
pip install --pre rawpy
Optional features
The underlying LibRaw library supports several optional features. The following table shows which PyPI binary wheels support which features.
Feature | Windows | macOS | Linux |
---|---|---|---|
LCMS color engine | yes | yes | yes |
RedCine codec | yes | yes | yes |
DNG deflate codec | yes | yes | yes |
DNG lossy codec | yes | yes | yes |
Demosaic Pack GPL2 | no | no | no |
Demosaic Pack GPL3 | no | no | no |
OpenMP | yes | no | yes |
Tip: You can dynamically query supported features by inspecting the rawpy.flags
dictionary.
Note on GPL demosaic packs: The GPL2 and GPL3 demosaic packs are not included as rawpy is licensed under the MIT license which is incompatible with GPL.
Installation from source on Linux/macOS
For macOS, LibRaw is built as part of the rawpy build (see external/). For Linux, you need to install the LibRaw library on your system.
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.20.0
cp -R ../libraw-cmake/* .
cmake .
sudo make install
After that, install rawpy using:
git clone https://github.com/letmaik/rawpy
cd rawpy
pip install numpy cython
pip install .
On Linux, 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.
Installation from source on Windows
These instructions are experimental and support is not provided for them. Typically, there should be no need to build manually since wheels are hosted on PyPI.
You need to have Visual Studio installed to build rawpy.
In a PowerShell window:
$env:USE_CONDA = '1'
$env:PYTHON_VERSION = '3.7'
$env:PYTHON_ARCH = '64'
$env:NUMPY_VERSION = '1.14.*'
git clone https://github.com/letmaik/rawpy
cd rawpy
.github/scripts/build-windows.ps1
The above will download all build dependencies (including a Python installation)
and is fully configured through the four environment variables.
Set USE_CONDA = '0'
to build within an existing Python environment.
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
File details
Details for the file newrawpy-0.20.0-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 851.2 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7451ea404f33a4019187fbc05f141ff5821ca7d2cc710eb015b473dca776431a |
|
MD5 | 0b8270e8fb4c5fde6ffdd8d3c98a8923 |
|
BLAKE2b-256 | 4671db9810f17b845f3069057b03e3bc5e36eb5c42f03502dd49bbb662de8cdb |
File details
Details for the file newrawpy-0.20.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3d8295431c129a09a7bbf24460db746fd30d0cbacc5886361a7edafeae62727 |
|
MD5 | d08007093b2f9d474897fe9bb2961430 |
|
BLAKE2b-256 | 829af502560b7a68679144299b084a9f6e2f0b26aabf25f7f9aa1569774e580f |
File details
Details for the file newrawpy-0.20.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eeec67d3ce99dcf9d77a870fc772dab5de94eec8b3a401f1c8f988edcfca359 |
|
MD5 | f7ee40569bcf5d1bba84aedb312c5d6b |
|
BLAKE2b-256 | c8c7c82e7b763b9314b5127d8da63526566fc31cafe65b32baae5e3694859377 |
File details
Details for the file newrawpy-0.20.0-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 986.9 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1cf6cc7ba8f6952b704d37184d6f363491e594f4504e6981eef65f6b69992d1 |
|
MD5 | 807eef96e875222d370dfeb620e3f4d3 |
|
BLAKE2b-256 | 514279f1cf560a7482ad371ae20bbdba5cb5d7561494dfcd66d443e10993b08a |
File details
Details for the file newrawpy-0.20.0-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7befa2036f0981c0f3aa406db348fc9291d40e8566c6c2344dd228f6d43838d9 |
|
MD5 | 44cde747f42ffe131439b7beafa2b1b3 |
|
BLAKE2b-256 | 1a2f6a5277fa159c25095979ae665ce259f0e65c0585f4cbdef399dec5f2de17 |
File details
Details for the file newrawpy-0.20.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 854.6 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6f601225d6861e841b02064c100580c3305d6e0c3338f02d208278bb611f20e |
|
MD5 | f570589366469b59917e2db7cf63aa40 |
|
BLAKE2b-256 | 5d3e8e0773257a9c20cf83150b50e460f92ecc85d0c96d9142e68b37a77da26c |
File details
Details for the file newrawpy-0.20.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34705fbf9ced025af4a06dbc9463e2df97f3412e865d9324b5aaa7b86b2d20e1 |
|
MD5 | b556b6e8be7b5b72e635f2dc58732161 |
|
BLAKE2b-256 | 13bd9ba13dae68450a41cc19b9196acf08f926b29a4865063d9907ab5a1941e9 |
File details
Details for the file newrawpy-0.20.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23b5a5423da3092ea0bc3b1b403b055140fd836ba546e040341d6eeba38d5475 |
|
MD5 | f4c56846d67bca92aee26ac35bdf198d |
|
BLAKE2b-256 | 2b76d73d46a43c4069fdd04f8c9ce3ad70a63c79d0a77470ea0f5e250b6b598b |
File details
Details for the file newrawpy-0.20.0-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 989.7 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ecba37f7126e60c267ffe44741e720efc3e7c54fee3f8732939f6963063b3ec |
|
MD5 | d78b0e2795db4bc162c6bedb76538a75 |
|
BLAKE2b-256 | 9fa9e44a8edafeef137b5142c4bfa638bab3aa5d4c7de2fb1519114398216e47 |
File details
Details for the file newrawpy-0.20.0-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ae741f49b86202ebc49f62b289a83cc6c7b3659336b2572c10615d25825d0b5 |
|
MD5 | 7e5f596498287580a71fa673f0f8a66f |
|
BLAKE2b-256 | de8e46a354b4468aca811bd53e626866be96ab349af402853cd10e72ba717c99 |
File details
Details for the file newrawpy-0.20.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 854.4 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3801e2a2b5f1e0bf270a9cf434bde98191cbc419b8f7917bc8e599f6db682b98 |
|
MD5 | 1e75a6af826ecb680d59a7d49d5c5f29 |
|
BLAKE2b-256 | 8da54f80d96ba544c8eb0c90c7c1774bd365f1730eef375f30e0244772d2b66f |
File details
Details for the file newrawpy-0.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2183d517a70b03c16267582c7226dfe3d2ff5ecb086ccd4e4dbc1deab56cdf82 |
|
MD5 | 8b45d820fb6d348463c35a3e77926500 |
|
BLAKE2b-256 | 4f4481531a8f09414c499e428d2fc10e7cdfeb935dcc963a809a094469b8b6cd |
File details
Details for the file newrawpy-0.20.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd0ad0f23498078a25625d4f174fba95c8872abcc51850c5d09781ce56917a0b |
|
MD5 | 4f555af25da1b7b3733b122c9e10427d |
|
BLAKE2b-256 | ccdf231cf63bc07537cdefa6ae39d6456cc8eb67d2fba5182532f2b38c9f0f2f |
File details
Details for the file newrawpy-0.20.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 989.1 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb7f728a6ff290abadb88b57c196d99b12d93297f93a8ac49bf2d3c0aa40c890 |
|
MD5 | 2e26aff6e7612f3e9bc8bb21475eb580 |
|
BLAKE2b-256 | 7fae010be9c4b53049b8bcc55dbfa71bf73d719b0126dd3d52817ca5c320c48c |
File details
Details for the file newrawpy-0.20.0-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaa6a2b8858a6183ad115b6fa7f65a5dc1adaf3c6912b15840fe3ee595e90e26 |
|
MD5 | 6a4340de58c6d5f47c258287342f12ef |
|
BLAKE2b-256 | e36ca47fb52bcff723d95fc7538ed08bbebc5bebd24231b8df502c81ec916b29 |
File details
Details for the file newrawpy-0.20.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 854.3 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b971b35af84ab88ae1319b86072e3faccf7a25b09a08890a1770ac2c0633424 |
|
MD5 | bf9f8b016f8ba4a350666bb954f79125 |
|
BLAKE2b-256 | a95e3820622b5eb2d822ef5351241c0d02e66187a3e4c106972076cfa268ef8a |
File details
Details for the file newrawpy-0.20.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68b79c8a44e58913fc8843fc855b91fe55c67b52fb919f1bd8adfac9dc89d5a6 |
|
MD5 | 51f19a48cc11b4f3ad2cd5efe2cdc21e |
|
BLAKE2b-256 | 065a86b87cebcb54facb664eb288e6669b0b149c347963d2832e448d728d8505 |
File details
Details for the file newrawpy-0.20.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f988882245b38d9159b7c7fd694943a509875f84a67e9e926523dc65f4fde343 |
|
MD5 | 38a57500375d0991b4096826c18d154a |
|
BLAKE2b-256 | dbf4198b1a27d4941d40f78d7ab230191874a7ca0f317d83817f379353faf4c9 |
File details
Details for the file newrawpy-0.20.0-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1da3cae5e953f9d7159331bdd7d2a5e67c0fa7fda9d7f354842dc6ecb487321 |
|
MD5 | ed925a48aa1b15480845447e009cfeb3 |
|
BLAKE2b-256 | 6f9544dd531aedb96a12bb7a2af6a9c869495698b696d2f36e75448de259a6a3 |
File details
Details for the file newrawpy-0.20.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 856.1 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdcb82af3164163c127631d4ad044cb8b405ea2e3554a7e143cbdd81635155ba |
|
MD5 | 847f7aa72441c08c13c262e942eeafd5 |
|
BLAKE2b-256 | effc934639b5054672d10430ced514762861d8bbf269dd12f84136f943e7dcf0 |
File details
Details for the file newrawpy-0.20.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2a50505e3b6f0c01ead97b47efdd81cf2cdbc2d0cc0be471c7cf471fccb0906 |
|
MD5 | bd20cf18aca3d55ae517a94630998ce6 |
|
BLAKE2b-256 | 07a1375b34eb45227c940a729ba375f48d81fc2690e35fd6afb2f87cc857244c |
File details
Details for the file newrawpy-0.20.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67572884e3c4ea05c801c3d38f4e90be1e2a388d30abe04f0d29d5c21062c7e6 |
|
MD5 | b7f8dcad8fa945515b97ffc35118582d |
|
BLAKE2b-256 | ebed570802882a2150cda0073cf1e83a24ad2a7bff00bcba5a2de4723b0cfa3d |
File details
Details for the file newrawpy-0.20.0-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: newrawpy-0.20.0-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9486d1d2369e435ca7eff264a5bdf8298e266bff08007afd0db7d3e01ca6248d |
|
MD5 | 7964854683050b83b36a06836ac40c83 |
|
BLAKE2b-256 | 92706009cfdbb79eea5c764e14d7fcfabe8918b25d4e77c280b2d3d30919a963 |