Skip to main content

flashraw

FlashRaw: the fast, safe camera RAW decoder

FlashRaw is a fast, memory-safe camera RAW decoder written in Rust, with Rust, C, C++, Python and JavaScript (WebAssembly) bindings. It decodes about 40 RAW formats (CR2, CR3, NEF, ARW, RAF, DNG, RW2, ORF, PEF and more) with SIMD kernels, multithreading and an optional GPU backend, converts to display-ready RGB with ICC colour management, and runs in the browser.

Official website and live demo: flashraw.ybouane.com (it decodes your file locally in the browser) · Source on GitHub · Follow @ybouane on X

Fast, safe camera RAW decoding for Python, with zero-copy NumPy output.

flashraw reads RAW files from most cameras (1,980 of the 2,016 files of the raw.pixls.us corpus; the rest are formats not supported yet, see docs/formats.md) — DNG, CR2, CR3, CRW, NEF/NRW, ARW/SR2/SRF, RAF, RW2, ORF, PEF, SRW, IIQ, 3FR/FFF, X3F, MRW, KDC/DCR, ERF, MEF and more — and returns sensor-domain data (or display-ready RGB) as NumPy arrays, together with everything needed to interpret them: CFA layout, black/white levels, white balance, colour matrices, crops, orientation, lens and exposure metadata, and embedded previews.

  • Fast: the decoder is written in Rust with SIMD kernels and multithreaded decoding (including single-stream formats such as CR2, lossless DNG and NEF).
  • Zero-copy: decoded pixels become the NumPy array's memory; bytes inputs and paths (memory-mapped) are not copied either.
  • Parallel: decoding releases the GIL — decode many files from Python threads.
  • Safe: bounds-checked parsing, safety limits for untrusted input, fuzzed; malformed input raises a FlashRawError, never crashes the interpreter. Truncated files are recovered with structured warnings (or rejected with corruption_policy="strict").
  • Typed: frozen dataclasses for metadata, py.typed, mypy --strict clean.

One abi3 wheel per platform supports CPython 3.9 and later (Linux x86-64/ARM64, macOS x86-64/ARM64, Windows x64; tested by the maintainers on Linux x86-64 and macOS arm64). The only dependency is NumPy.

Install

pip install flashraw
pip install "flashraw[pil]"   # optional: Frame.to_pil()

Usage

import flashraw

with flashraw.open("photo.NEF") as raw:          # path, bytes, bytearray, memoryview or file object
    m = raw.metadata
    print(m.camera.name, m.lens.model, m.exposure.iso, m.exposure.exposure_time)
    print(m.cfa.pattern, m.black_level.mean, m.white_level, m.white_balance)

    frame = raw.decode()                          # sensor data
    frame.array                                   # numpy uint16, shape (height, width)
    frame.active_view()                           # view of the active area

    rgba = raw.decode("rgba8").array              # display-ready sRGB, uint8 (h, w, 4)
    raw.decode("rgba8").to_pil().save("photo.png")

    jpeg = raw.preview_bytes()                    # embedded JPEG preview, no decoding

# One-liner:
image = flashraw.imread("photo.CR3")              # RGBA8 array

Outputs (output=, the first argument of decode / imread):

output dtype, shape content
raw-u16 uint16 (h, w) or (h, w, c) sensor samples as stored (default)
raw-f32 float32 (h, w) or (h, w, c) the same as floats (floating-point DNGs unscaled)
normalized float32 (h, w) or (h, w, c) black-subtracted, white-normalised to [0, 1], CFA layout kept
linear-rgb float32 (h, w, 3) demosaiced, white-balanced, linear sRGB primaries (or color_space)
linear-rgb-f16 float16 (h, w, 3) the same as half floats
linear-rgb16 uint16 (h, w, 3) the same, clipped to [0, 1] and scaled to [0, 65535]
rgba8 uint8 (h, w, 4) display-ready sRGB, orientation applied
rgb16 uint16 (h, w, 3) display-ready sRGB at 16 bits, orientation applied

Options of decode: backend ("auto", "cpu", "simd", "gpu"), threads, region, crop (True, or "active" for raw outputs), demosaic ("bilinear", "half-size", "edge-aware"), highlights ("clip", "neutral", "blend", "reconstruct"), white_balance ("as-shot", "auto"), apply_opcodes, corruption_policy ("recover", "strict"), exposure, black_point, white_point, preview_fallback (RGB outputs of undecodable sensor data return the embedded full-size preview, frame.source == "preview"), color_space ("srgb", "display-p3", "adobe-rgb", "prophoto", "rec2020"; frame.icc_profile is the matching ICC profile), output_profile (convert to any RGB ICC profile; with intent and black_point_compensation), camera_profile (render with a DNG camera profile: the bytes or path of a .dcp file, or "embedded" for the profile stored in the DNG; CPU only), cancel (a flashraw.CancelToken: call its cancel() from another thread and the decode raises flashraw.CancelledError soon after). flashraw.open takes max_samples and max_dimension to tighten the limits for untrusted files. Names that differ from the other bindings: docs/api-names.md.

from concurrent.futures import ThreadPoolExecutor

def decode(path):
    return flashraw.imread(path, "raw-u16", threads=1)

with ThreadPoolExecutor(8) as pool:               # runs in parallel: the GIL is released
    arrays = list(pool.map(decode, paths))

Errors derive from flashraw.FlashRawError (UnsupportedFormatError, CorruptFileError with structured truncation details, InvalidArgumentError, ...).

Documentation: docs/python.md. FlashRaw is also available as a Rust crate, a command-line tool and an npm package (repository).

License

MIT OR Apache-2.0.

Built with FlashRaw

  • LightFlow: professional photo correction and colour grading, running locally in your browser with WebGPU.
  • ImageFlow: a Photoshop-class image editor in your browser.

Official website: flashraw.ybouane.com · Created by @ybouane · Licence: MIT OR Apache-2.0

Metadata

Release files for flashraw 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flashraw 0.5.3
File Size Uploaded Provenance Actions
flashraw-0.5.3.tar.gz 1.2 MB With provenance Details for flashraw-0.5.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for flashraw 0.5.3
File Actions
flashraw-0.5.3-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for flashraw-0.5.3-cp39-abi3-win_amd64.whl
flashraw-0.5.3-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for flashraw-0.5.3-cp39-abi3-manylinux_2_28_x86_64.whl
flashraw-0.5.3-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for flashraw-0.5.3-cp39-abi3-manylinux_2_28_aarch64.whl
flashraw-0.5.3-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for flashraw-0.5.3-cp39-abi3-macosx_11_0_arm64.whl
flashraw-0.5.3-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for flashraw-0.5.3-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 36.0 MB

Release files / flashraw-0.5.3.tar.gz

Download URL flashraw-0.5.3.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
ba0414e9eeb718844ebaa1566a780b49c5d762f2f31466628eaf3ac5d710858e
BLAKE2b-256 checksum
How to use checksums
2cd9b6390c82a42cff73fad4f90db135d2210d0a1a39fe36d52c76500e906adf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / flashraw-0.5.3-cp39-abi3-win_amd64.whl

Download URL flashraw-0.5.3-cp39-abi3-win_amd64.whl
Size 3.9 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
667a7ab096e4b9329ce5705f4df4ab6ab41843fd4468e98bd655a56a55e0eb1f
BLAKE2b-256 checksum
How to use checksums
44d7f43a2fcd8d725b6b5f8770392f9d3d8aa57683106ff5d9b5b144e6e65e9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / flashraw-0.5.3-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL flashraw-0.5.3-cp39-abi3-manylinux_2_28_x86_64.whl
Size 12.1 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
0033ea73058eb63348f1571e6d35ad328fc6a2d685305e16e0e2f0dcacbf6cd1
BLAKE2b-256 checksum
How to use checksums
091452c620c0a3c01c17a61cd3b0f8f3c5e772b1859d838a9a137f6cff63f387
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / flashraw-0.5.3-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL flashraw-0.5.3-cp39-abi3-manylinux_2_28_aarch64.whl
Size 11.0 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
c60ac5e2c8225dd4f9cc8d75b0f5b28e6f5cd2242a03a5a2f84f7a9a4cfe5735
BLAKE2b-256 checksum
How to use checksums
9e20873f577357186276a240f2174fb17dfcff513a2e65f0507f67d67e9149ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / flashraw-0.5.3-cp39-abi3-macosx_11_0_arm64.whl

Download URL flashraw-0.5.3-cp39-abi3-macosx_11_0_arm64.whl
Size 3.8 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d4d536d04e843e1c0e03e32da4899e42defda1c9b327760a85ac082951408fb2
BLAKE2b-256 checksum
How to use checksums
4399cd5b5e9eab587f603a243e80c086cc0510d6135ea2b9cfe0fcebb5068c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / flashraw-0.5.3-cp39-abi3-macosx_10_12_x86_64.whl

Download URL flashraw-0.5.3-cp39-abi3-macosx_10_12_x86_64.whl
Size 4.0 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0f82e83da18274aa55924133360f291b54914c750bd5e66f8c2c0efdf36967b0
BLAKE2b-256 checksum
How to use checksums
998398a05dfd130b3c9887dda41a98495e04a5c1fedfe62338a86bce041628ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for flashraw 0.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for flashraw-0.5.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page