Add support for RAW digicam input, requires custom libvips+libraw

This commit is contained in:
Lovell Fuller 2025-06-30 12:14:06 +01:00
parent 32cf6be1b8
commit df5454e7dc
6 changed files with 10 additions and 3 deletions

View File

@ -18,6 +18,8 @@ Requires libvips v8.17.0
* Expose `keepDuplicateFrames` GIF output parameter. * Expose `keepDuplicateFrames` GIF output parameter.
* Add support for RAW digital camera image input. Requires libvips compiled with libraw support.
* Add `pageHeight` option to `create` and `raw` input for animated images. * Add `pageHeight` option to `create` and `raw` input for animated images.
[#3236](https://github.com/lovell/sharp/issues/3236) [#3236](https://github.com/lovell/sharp/issues/3236)

1
lib/index.d.ts vendored
View File

@ -1890,6 +1890,7 @@ declare namespace sharp {
interface FormatEnum { interface FormatEnum {
avif: AvailableFormatInfo; avif: AvailableFormatInfo;
dcraw: AvailableFormatInfo;
dz: AvailableFormatInfo; dz: AvailableFormatInfo;
exr: AvailableFormatInfo; exr: AvailableFormatInfo;
fits: AvailableFormatInfo; fits: AvailableFormatInfo;

View File

@ -179,12 +179,12 @@
"icc": "^3.0.0", "icc": "^3.0.0",
"jsdoc-to-markdown": "^9.1.1", "jsdoc-to-markdown": "^9.1.1",
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
"mocha": "^11.7.0", "mocha": "^11.7.1",
"node-addon-api": "^8.4.0", "node-addon-api": "^8.4.0",
"node-gyp": "^11.2.0", "node-gyp": "^11.2.0",
"nyc": "^17.1.0", "nyc": "^17.1.0",
"semistandard": "^17.0.0", "semistandard": "^17.0.0",
"tar-fs": "^3.0.10", "tar-fs": "^3.1.0",
"tsd": "^0.32.0" "tsd": "^0.32.0"
}, },
"license": "Apache-2.0", "license": "Apache-2.0",

View File

@ -284,6 +284,7 @@ namespace sharp {
case ImageType::EXR: id = "exr"; break; case ImageType::EXR: id = "exr"; break;
case ImageType::JXL: id = "jxl"; break; case ImageType::JXL: id = "jxl"; break;
case ImageType::RAD: id = "rad"; break; case ImageType::RAD: id = "rad"; break;
case ImageType::DCRAW: id = "dcraw"; break;
case ImageType::VIPS: id = "vips"; break; case ImageType::VIPS: id = "vips"; break;
case ImageType::RAW: id = "raw"; break; case ImageType::RAW: id = "raw"; break;
case ImageType::UNKNOWN: id = "unknown"; break; case ImageType::UNKNOWN: id = "unknown"; break;
@ -332,6 +333,8 @@ namespace sharp {
{ "VipsForeignLoadJxlBuffer", ImageType::JXL }, { "VipsForeignLoadJxlBuffer", ImageType::JXL },
{ "VipsForeignLoadRadFile", ImageType::RAD }, { "VipsForeignLoadRadFile", ImageType::RAD },
{ "VipsForeignLoadRadBuffer", ImageType::RAD }, { "VipsForeignLoadRadBuffer", ImageType::RAD },
{ "VipsForeignLoadDcRawFile", ImageType::DCRAW },
{ "VipsForeignLoadDcRawBuffer", ImageType::DCRAW },
{ "VipsForeignLoadVips", ImageType::VIPS }, { "VipsForeignLoadVips", ImageType::VIPS },
{ "VipsForeignLoadVipsFile", ImageType::VIPS }, { "VipsForeignLoadVipsFile", ImageType::VIPS },
{ "VipsForeignLoadRaw", ImageType::RAW } { "VipsForeignLoadRaw", ImageType::RAW }

View File

@ -169,6 +169,7 @@ namespace sharp {
EXR, EXR,
JXL, JXL,
RAD, RAD,
DCRAW,
VIPS, VIPS,
RAW, RAW,
UNKNOWN, UNKNOWN,

View File

@ -119,7 +119,7 @@ Napi::Value format(const Napi::CallbackInfo& info) {
Napi::Object format = Napi::Object::New(env); Napi::Object format = Napi::Object::New(env);
for (std::string const f : { for (std::string const f : {
"jpeg", "png", "webp", "tiff", "magick", "openslide", "dz", "jpeg", "png", "webp", "tiff", "magick", "openslide", "dz",
"ppm", "fits", "gif", "svg", "heif", "pdf", "vips", "jp2k", "jxl", "rad" "ppm", "fits", "gif", "svg", "heif", "pdf", "vips", "jp2k", "jxl", "rad", "dcraw"
}) { }) {
// Input // Input
const VipsObjectClass *oc = vips_class_find("VipsOperation", (f + "load").c_str()); const VipsObjectClass *oc = vips_class_find("VipsOperation", (f + "load").c_str());