{"_id":"@colorhythm/libraw-wasm","_rev":"3-a45ca9af7fa19edf86bc654cc8cba492","name":"@colorhythm/libraw-wasm","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@colorhythm/libraw-wasm","version":"1.0.0","keywords":["libraw","raw","image","wasm","webassembly"],"author":{"name":"TOMIKAWA Sotaro","email":"tommysouta@gmail.com"},"license":"MIT","_id":"@colorhythm/libraw-wasm@1.0.0","maintainers":[{"name":"altert","email":"atikhonov@colorhythm.com"},{"name":"colorhythm2","email":"info@colorhythm.com"}],"homepage":"https://github.com/ssssota/libraw.wasm#readme","bugs":{"url":"https://github.com/ssssota/libraw.wasm/issues"},"dist":{"shasum":"724ffbce7dad5ada4833296cf609f51b5152f502","tarball":"https://registry.npmjs.org/@colorhythm/libraw-wasm/-/libraw-wasm-1.0.0.tgz","fileCount":12,"integrity":"sha512-owb9mrBXuhRDUrxDKlSbjUqZDv3uQWZSmqgh2oGZn7z/ciZya1xDVmTM/TLm8+JYX6a34Fdqgb7SW8m7ucw6Uw==","signatures":[{"sig":"MEMCICHjXhT92w++fcW8Gnvn/XFE+vkVw2QR/eJ0rmwUmStTAh8jvSL9fZD0tj2Cd1yPyDGfbnvGaEG5JEwDb+OcBs3w","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1153201},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./libraw.wasm":{"default":"./dist/libraw.wasm"}},"gitHead":"774fd095751cbc1553c467a956b4b615fad25445","scripts":{"build":"pnpm build:wasm && pnpm build:bindings && pnpm build:ts","watch":"pnpm run \"/^watch:.*/\"","build:ts":"tsc","watch:ts":"tsc -w","build:wasm":"node scripts/build.mjs","build:bindings":"node scripts/bindings.mjs"},"_npmUser":{"name":"colorhythm2","email":"info@colorhythm.com"},"repository":{"url":"git+https://github.com/ssssota/libraw.wasm.git","type":"git"},"_npmVersion":"11.6.2","description":"WebAssembly build of [LibRaw](https://www.libraw.org/), a library for reading RAW iamges.","directories":{},"_nodeVersion":"24.8.0","dependencies":{"typed-cstruct":"^0.10.2"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"catalog:","@types/node":"^22.13.4","@typed-cstruct/generator":"^0.5.0"},"_npmOperationalInternal":{"tmp":"tmp/libraw-wasm_1.0.0_1782978859716_0.9408978170819364","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@colorhythm/libraw-wasm","version":"1.1.0","keywords":["camera","camera-raw","image","libraw","raw","wasm","webassembly"],"author":{"name":"TOMIKAWA Sotaro","email":"tommysouta@gmail.com"},"license":"MIT","_id":"@colorhythm/libraw-wasm@1.1.0","maintainers":[{"name":"altert","email":"atikhonov@colorhythm.com"},{"name":"colorhythm2","email":"info@colorhythm.com"}],"homepage":"https://github.com/colorhythm/libraw-wasm#readme","bugs":{"url":"https://github.com/colorhythm/libraw-wasm/issues"},"dist":{"shasum":"3b036a7cbdb66d8429303046e4cff1725944c0a6","tarball":"https://registry.npmjs.org/@colorhythm/libraw-wasm/-/libraw-wasm-1.1.0.tgz","fileCount":17,"integrity":"sha512-iJQX6g0zdHHXtdhtrjAl9UTNnsKNc37RPBiLkJh/4pJ7pt5nyl7oFbZmf/4nOP34LHlxJbmK14uk8HAb2pVxTw==","signatures":[{"sig":"MEUCICX1+BxnOC8hVhZMfW0nQq2BqLlLTilonH5KIYGxrXndAiEA/V3w32DT7AB3mItAcVKu0+686QC0PYlBNsqjb235ZMY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@colorhythm%2flibraw-wasm@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1238113},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./libraw.wasm":{"default":"./dist/libraw.wasm"}},"gitHead":"89397f29c2fc598c370d70879201f905ef74402a","scripts":{"build":"pnpm build:wasm && pnpm build:bindings && pnpm build:ts","watch":"pnpm run \"/^watch:.*/\"","prepack":"node scripts/verify-package.mjs","build:ts":"tsc","watch:ts":"tsc -w","build:wasm":"node scripts/build.mjs","build:bindings":"node scripts/bindings.mjs"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:44c4fd52-0e23-4eeb-ad82-0bcde1685e3c"}},"repository":{"url":"git+https://github.com/colorhythm/libraw-wasm.git","type":"git","directory":"packages/libraw.wasm"},"_npmVersion":"11.5.1","description":"LibRaw WebAssembly bindings with camera-raw analysis surfaces for browser and Node.js applications.","directories":{},"_nodeVersion":"24.18.0","dependencies":{"typed-cstruct":"^0.10.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"catalog:","@types/node":"^22.13.4","@typed-cstruct/generator":"^0.5.0"},"_npmOperationalInternal":{"tmp":"tmp/libraw-wasm_1.1.0_1785786273853_0.9529469703741722","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@colorhythm/libraw-wasm","version":"1.1.1","description":"LibRaw WebAssembly bindings with camera-raw analysis surfaces for browser and Node.js applications.","type":"module","main":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./libraw.wasm":{"default":"./dist/libraw.wasm"}},"scripts":{"build":"pnpm build:wasm && pnpm build:bindings && pnpm build:ts","build:bindings":"node scripts/bindings.mjs","build:ts":"tsc","build:wasm":"node scripts/build.mjs","prepack":"node scripts/verify-package.mjs","watch":"pnpm run \"/^watch:.*/\"","watch:ts":"tsc -w"},"repository":{"directory":"packages/libraw.wasm","type":"git","url":"git+https://github.com/colorhythm/libraw-wasm.git"},"keywords":["camera","camera-raw","image","libraw","raw","wasm","webassembly"],"author":{"name":"TOMIKAWA Sotaro","email":"tommysouta@gmail.com"},"license":"MIT","publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/colorhythm/libraw-wasm/issues"},"homepage":"https://github.com/colorhythm/libraw-wasm#readme","devDependencies":{"@typed-cstruct/generator":"^0.5.0","@types/node":"^22.13.4","typescript":"catalog:"},"dependencies":{"typed-cstruct":"^0.10.2"},"_id":"@colorhythm/libraw-wasm@1.1.1","gitHead":"9b0f59a5e0f6d3d12a8f6fa594015ef4f30a6e95","types":"./dist/index.d.ts","_nodeVersion":"24.18.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-OxqXLhDurX/sM4KL/rR71zjuH0VHBUWCOJ71tLiIxy3ATbIS2KM/8RixT0Gc3RygcsS1T8SXnzdipPqWYSjt9A==","shasum":"c6e8f78ae51721c360377f6d057486dd5a15b3f7","tarball":"https://registry.npmjs.org/@colorhythm/libraw-wasm/-/libraw-wasm-1.1.1.tgz","fileCount":17,"unpackedSize":1294596,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@colorhythm%2flibraw-wasm@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHSD+G3tNpS1o9dTTcbCPrUjQhmB9+o5tHM4QchE5k1ZAiBvd8wc/Q7QPp0p21j1wdCibYwFJl41IKboHpjcA0nRhA=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:44c4fd52-0e23-4eeb-ad82-0bcde1685e3c"}},"directories":{},"maintainers":[{"name":"altert","email":"atikhonov@colorhythm.com"},{"name":"colorhythm2","email":"info@colorhythm.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/libraw-wasm_1.1.1_1785792938515_0.3751125081165587"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-02T07:54:19.531Z","modified":"2026-08-03T21:35:39.087Z","1.0.0":"2026-07-02T07:54:19.899Z","1.1.0":"2026-08-03T19:44:33.995Z","1.1.1":"2026-08-03T21:35:38.752Z"},"bugs":{"url":"https://github.com/colorhythm/libraw-wasm/issues"},"author":{"name":"TOMIKAWA Sotaro","email":"tommysouta@gmail.com"},"license":"MIT","homepage":"https://github.com/colorhythm/libraw-wasm#readme","keywords":["camera","camera-raw","image","libraw","raw","wasm","webassembly"],"repository":{"directory":"packages/libraw.wasm","type":"git","url":"git+https://github.com/colorhythm/libraw-wasm.git"},"description":"LibRaw WebAssembly bindings with camera-raw analysis surfaces for browser and Node.js applications.","maintainers":[{"name":"altert","email":"atikhonov@colorhythm.com"},{"name":"colorhythm2","email":"info@colorhythm.com"}],"readme":"<!-- This README is duplicated at the repository root and package directory. -->\n\n# @colorhythm/libraw-wasm\n\n[![npm version](https://img.shields.io/npm/v/%40colorhythm%2Flibraw-wasm.svg)](https://www.npmjs.com/package/@colorhythm/libraw-wasm)\n\nTypeScript bindings for [LibRaw](https://www.libraw.org/), compiled to\nWebAssembly for browser and Node.js camera-raw decoding. Colorhythm maintains\nthis fork for applications that need direct, analysis-oriented access to\nsensor data—not only a rendered RGB image.\n\nThe package is intentionally low-level. It can expose the stored sensor buffer,\nvisible image geometry, color-filter facts, camera characterization, black and\nsaturation levels, embedded metadata, thumbnails, and LibRaw's processed\noutput. Heavy decoding and pixel statistics should normally run in a Worker.\n\n## What Colorhythm adds\n\nThis fork preserves the original API and adds surfaces needed for browser-side\ncamera-raw analysis:\n\n- Stored and visible geometry, including margins, orientation, pixel\n  aspect, and row pitch\n- CFA and Foveon source facts, plus 16-bit one-, three-, and four-component\n  buffers\n- Camera matrices, channel descriptions, and white-balance multipliers\n- Rawpy-compatible adjusted black levels and reported per-channel linear maxima\n- Processing setters for `half_size` and `use_camera_wb`\n- Typed `LibRawError` diagnostics with stable numeric LibRaw error codes\n- LibRaw's X3F decoder compiled into the WebAssembly build\n\n## Install\n\n```sh\nnpm install @colorhythm/libraw-wasm\n```\n\nThe generated module loads `libraw.wasm` beside itself through `import.meta.url`\nin Node.js and compatible bundlers. The WebAssembly binary is also\nexported as `@colorhythm/libraw-wasm/libraw.wasm` for applications with a\ncustom asset pipeline.\n\n## Inspect a camera-raw file\n\n```ts\nimport { LibRaw } from \"@colorhythm/libraw-wasm\";\n\nasync function inspectCameraRaw(file: File) {\n    await LibRaw.initialize();\n\n    const decoder = new LibRaw();\n    await decoder.waitUntilReady();\n\n    try {\n        decoder.open(await file.arrayBuffer());\n        decoder.unpack();\n\n        const source =\n            decoder.getRawImage() ??\n            decoder.getColor3Image() ??\n            decoder.getColor4Image();\n\n        if (source === null) {\n            throw new Error(\"LibRaw did not expose an unpacked source buffer\");\n        }\n\n        const camera = decoder.getIParams();\n\n        return {\n            blackLevels: [0, 1, 2, 3].map((index) =>\n                decoder.getBlackLevel(index),\n            ),\n            camera: `${camera.normalized_make} ${camera.normalized_model}`,\n            geometry: {\n                activeHeight: decoder.getActiveHeight(),\n                activeWidth: decoder.getActiveWidth(),\n                marginLeft: decoder.getLeftMargin(),\n                marginTop: decoder.getTopMargin(),\n                storedHeight: decoder.getRawHeight(),\n                storedWidth: decoder.getRawWidth(),\n            },\n            sourceSamples: source.length,\n        };\n    } finally {\n        decoder.dispose();\n    }\n}\n```\n\n`getRawImage()`, `getColor3Image()`, and `getColor4Image()` return\nowned `Uint16Array` copies after `unpack()`. They remain valid after another\ndecode, `recycle()`, WebAssembly memory growth, or `dispose()`. A method returns\n`null` when LibRaw does not expose that source layout for the file. The current\nbinding does not expose LibRaw's floating-point source buffers.\n\n## 1.1.0 compatibility note\n\nVersion 1.1.0 corrects the source-pixel return contract introduced in 1.0.0.\nThe TypeScript return type is `Uint16Array | null`, each non-null array has the\nexact unpacked length without row padding, and every array owns its storage.\nCode that assumed the earlier non-null type should select the available source\nlayout explicitly, as in the example above.\n\n## Error handling\n\nLibRaw failures throw `LibRawError`, which preserves the numeric LibRaw error\ncode alongside its diagnostic message:\n\n```ts\nimport { LibRawError } from \"@colorhythm/libraw-wasm\";\n\ntry {\n    decoder.open(buffer);\n} catch (error) {\n    if (error instanceof LibRawError) {\n        console.error(error.code, error.message);\n    }\n    throw error;\n}\n```\n\n## Analysis API\n\n| Area | Methods | Notes |\n| --- | --- | --- |\n| Geometry | `getActiveHeight()`, `getActiveWidth()`, `getRawHeight()`, `getRawWidth()`, `getRawPitch()`, margin getters, `getFlip()`, `getPixelAspect()` | Raw dimensions describe stored data; LibRaw's visible dimensions and margins locate the image area. These values are not necessarily the literal DNG `ActiveArea`. Pitch is measured in bytes. |\n| Source layout | `getColors()`, `getCdesc()`, `getFilters()`, `getIsFoveon()`, `color()` | Describes CFA and multi-channel source organization. `getCdesc()` returns a character code. |\n| Source pixels | `getRawImage()`, `getColor3Image()`, `getColor4Image()` | Returns the unpacked 16-bit source buffer that LibRaw exposes for the file. |\n| Levels | `getBlackLevel()`, `getLinearMax()`, `getColorMaximum()`, `getDataMaximum()` | Exposes adjusted per-channel black levels, per-channel linear maxima, and LibRaw's common and observed maxima. A per-channel linear maximum can be `0` when the file does not provide one. |\n| Characterization | `getCamMul()`, `getPreMul()`, `getCamXyz()`, `getCmatrix()`, `getRgbCam()` | Exposes camera white-balance multipliers and numeric color matrices. |\n| Descriptive metadata | `getIParams()`, `getImgOther()`, `getLensInfo()`, `getMakernotes()`, `getShootingInfo()` | Reads LibRaw's typed metadata structures. Use a dedicated metadata parser when complete tag coverage is required. |\n| Thumbnails and rendering | `unpackThumb()`, `dcrawMakeMemThumb()`, `dcrawProcess()`, `dcrawMakeMemImage()` | Provides embedded previews and LibRaw's processed output path. |\n\nStatic methods expose the compiled LibRaw version, supported camera count, and\ncamera list:\n\n```ts\nawait LibRaw.initialize();\n\nconsole.log(LibRaw.version());\nconsole.log(LibRaw.cameraCount());\nconsole.log(LibRaw.cameraList());\n```\n\n## Processing policy\n\nSet processing parameters before `dcrawProcess()`. `setHalfSize(1)` requests\nhalf linear dimensions, while `setUseCameraWb(1)` requests the camera's as-shot\nwhite-balance multipliers. Applications should also choose their output color\nspace explicitly with `setOutputColor()` rather than inherit an implicit\nLibRaw default.\n\nThe unpacked source path does not call `dcrawProcess()` and therefore remains\nappropriate for sensor-native analysis.\n\n## Worker use\n\nCamera-raw decoding and full-resolution statistics can consume substantial CPU\ntime and memory. In browser applications, create and use `LibRaw` inside a\ndedicated Worker. Transfer the input `ArrayBuffer` to the Worker, perform\nanalysis there, and return only the summaries or pixel data the interface\nneeds.\n\nEach successful `open()` keeps its copied input alive until another `open()`,\n`recycle()`, or `dispose()` releases it. Reuse a decoder for sequential jobs or\ndispose it when the Worker is finished. Source-pixel getters return owned\ncopies that can be transferred or retained independently.\n\n## WebAssembly loading and lifecycle\n\n`LibRaw.initialize()` is shared within a JavaScript realm, and its first call\nselects the WebAssembly payload. Supply any custom `Response` or `ArrayBuffer`\nbefore constructing a decoder:\n\n```ts\nconst response = await fetch(\"/assets/libraw.wasm\");\n\nif (!response.ok) {\n    throw new Error(`Unable to load LibRaw WASM: ${response.status}`);\n}\n\nawait LibRaw.initialize(await response.arrayBuffer());\n```\n\nPassing an `ArrayBuffer` avoids a dependency on the server's WebAssembly MIME\ntype. Passing a `Response` enables streaming compilation and requires the\nserver to send `application/wasm`.\n\n## Develop\n\nClone with submodules, install the workspace, and run the checks:\n\n```sh\ngit clone --recurse-submodules https://github.com/colorhythm/libraw-wasm.git\ncd libraw-wasm\ncorepack enable\npnpm install\npnpm check\npnpm test\n```\n\nRebuilding the WebAssembly binary requires `make` and Emscripten. Put `emcc`\nand `em++` on `PATH`, set `SYSROOT` to Emscripten's `cache/sysroot` directory,\nthen run `pnpm build`. The repository's\n[build setup action](https://github.com/colorhythm/libraw-wasm/blob/main/.github/actions/setup-build/action.yml)\nis the executable reference for the supported toolchain.\n\n## Lineage and thanks\n\nThis is Colorhythm's maintained fork of\n[libraw.wasm](https://github.com/ssssota/libraw.wasm) by\n[TOMIKAWA Sotaro](https://github.com/ssssota). His TypeScript bindings and\nWebAssembly build made browser-side LibRaw practical to extend. Thank you,\nSotaro.\n\n[LibRaw](https://github.com/LibRaw/LibRaw) is developed by LibRaw LLC and its\ncontributors.\n\n## License\n\nThe TypeScript and WebAssembly wrapper is available under the\n[MIT License](https://github.com/colorhythm/libraw-wasm/blob/main/packages/libraw.wasm/LICENSE).\nThe included LibRaw source is available under either\n[LGPL 2.1](https://github.com/colorhythm/libraw-wasm/blob/main/packages/libraw.wasm/LibRaw/LICENSE.LGPL)\nor\n[CDDL 1.0](https://github.com/colorhythm/libraw-wasm/blob/main/packages/libraw.wasm/LibRaw/LICENSE.CDDL).\nSee LibRaw's\n[copyright and notices](https://github.com/colorhythm/libraw-wasm/blob/main/packages/libraw.wasm/LibRaw/COPYRIGHT)\nfor its included third-party components. The npm tarball includes all three\nLibRaw files under `LibRaw/`.\n","readmeFilename":"README.md"}