RawHandler is a lightweight wrapper around rawpy that provides convenient tools for working with raw sensor data, particularly for training neural networks on raw images.
RawHandler can:
-
Open and convert most camera raw files into numpy arrays.
-
Apply black and white point correction automatically.
-
Provide multiple representations of the underlying sensor data:
- Mono Bayer representation
- 3-channel sparse representation
- 4-channel RGGB representation
-
Demosaic Bayer data using colour-demosaicing, supporting:
- Bilinear interpolation
- Malvar–He–Cutler (2004)
- DDFAPD – Menon et al. (2007)
-
Convert color spaces from the camera’s native space to standard targets such as XYZ, sRGB, AdobeRGB, or linear Rec.2020 — all available for every representation.
-
Crop, resize, and generate thumbnails while preserving Bayer pattern alignment.
-
Read EXIF/metadata information (ISO, shutter speed, orientation, etc.) and return it as a convenient Python dictionary.
Currently supported: Bayer raw images In progress: Fujifilm X-Trans support
You can install RawHandler directly from PyPI:
pip install RawHandlerOr install locally from source:
# Clone the repository
git clone https://github.com/rymuelle/RawHandler.git
cd RawHandler
# Editable/development install
pip install -e .
# Standard local install
pip install .A simple demo notebook is available:
examples/simple_demosaicing.ipynb
This example downloads a raw image and demonstrates the basic functionality of RawHandler.
This project is released under the MIT License.
Special thanks to the authors of RawNIND:
Brummer, Benoit; De Vleeschouwer, Christophe, 2025. Raw Natural Image Noise Dataset. https://doi.org/10.14428/DVN/DEQCIM, Open Data @ UCLouvain, V1.