Skip to content

Add rawImageData() + local rebuild at LibRaw 0.22.1#16

Merged
ybouane merged 2 commits into
mainfrom
rebuild-022-rawimagedata
Jun 10, 2026
Merged

Add rawImageData() + local rebuild at LibRaw 0.22.1#16
ybouane merged 2 commits into
mainfrom
rebuild-022-rawimagedata

Conversation

@ybouane

@ybouane ybouane commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to merging #14 (types) and #15 (LibRaw 0.22.1) — adds the one genuinely-missing feature from the stale #4 and rebuilds the binaries from source so they're verified locally rather than trusted as prebuilt blobs.

  • rawImageData() — returns the raw, undebayered 16-bit sensor mosaic without demosaicing. Reimplemented from @hrueger's Minor improvements #4 on top of the current codebase (wrapper binding + index.js method + RawSensorData type + README/example docs).
  • Local rebuild of libraw.js / libraw.wasm + static libs from source at the pinned LibRaw 0.22.1 / LCMS 2.19.1 (Emscripten 4.0.1), replacing rebuild with LibRaw 0.22.1 — add Nikon Z f, Z8, Z6III and more camera support #15's prebuilt binaries with locally-built ones.
  • Version bump to 1.3.0 and contributor credits.

Verification

Drove the rebuilt module in headless Chrome (COOP/COEP) against example-sony.ARW:

  • metadata → Sony ILME-FX30, 6240×4168, ISO 800 ✅
  • imageData() → 3120×2084 (half-size), 3ch/8-bit Uint8Array
  • rawImageData()Uint16Array length 26,141,696 = 6272×4168 full sensor mosaic ✅
  • thumbnailData() → embedded JPEG returned ✅

Note

LibRaw 0.22.1 is the latest stable tag (checked upstream tags) — no newer version to adopt.

🤖 Generated with Claude Code

- Add rawImageData() returning the raw, undebayered 16-bit sensor mosaic
  (wrapper binding + index.js method + RawSensorData type + README/example).
  Reimplemented from @hrueger's PR #4 on top of the current codebase.
- Rebuild libraw.js/libraw.wasm + static libs locally from source at the
  pinned LibRaw 0.22.1 / LCMS 2.19.1 (Emscripten 4.0.1), verifying the
  binaries decode example-sony.ARW correctly (Sony ILME-FX30).
- Bump version to 1.3.0 and credit PR contributors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ybouane ybouane mentioned this pull request Jun 9, 2026
dcraw_make_mem_thumb() only fills width/height for bitmap thumbnails and
leaves them at 0 for JPEG passthrough. Fall back to the dimensions LibRaw
parsed into imgdata.thumbnail (twidth/theight) during identify.

Verified on example-sony.ARW: thumbnail now reports 6192x4128 (was 0x0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ybouane

ybouane commented Jun 10, 2026

Copy link
Copy Markdown
Owner Author

Also fixed thumbnailData() returning width:0, height:0 for JPEG thumbnails — now falls back to the dimensions LibRaw parsed during identify. Verified on example-sony.ARW: thumbnail reports 6192×4128 (was 0×0).

@ybouane ybouane merged commit 948bf71 into main Jun 10, 2026
@ybouane ybouane deleted the rebuild-022-rawimagedata branch June 10, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant