@revizly/sharp 0.35.0-revizly31 → 0.35.0-revizly32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -383,6 +383,7 @@ const Sharp = function (input, options) {
383
383
  heifChromaSubsampling: '4:4:4',
384
384
  heifBitdepth: 8,
385
385
  heifTune: 'ssim',
386
+ heifEncoder: 'auto',
386
387
  jxlDistance: 1,
387
388
  jxlDecodingTier: 0,
388
389
  jxlEffort: 7,
@@ -383,6 +383,7 @@ const Sharp = function (input, options) {
383
383
  heifChromaSubsampling: '4:4:4',
384
384
  heifBitdepth: 8,
385
385
  heifTune: 'ssim',
386
+ heifEncoder: 'auto',
386
387
  jxlDistance: 1,
387
388
  jxlDecodingTier: 0,
388
389
  jxlEffort: 7,
package/dist/output.cjs CHANGED
@@ -1317,6 +1317,13 @@ function heif (options) {
1317
1317
  throw is.invalidParameterError('tune', 'one of: psnr, ssim, iq', options.tune);
1318
1318
  }
1319
1319
  }
1320
+ if (is.defined(options.encoder)) {
1321
+ if (is.string(options.encoder) && is.inArray(options.encoder, ['auto', 'aom', 'rav1e', 'svt', 'x265'])) {
1322
+ this.options.heifEncoder = options.encoder;
1323
+ } else {
1324
+ throw is.invalidParameterError('encoder', 'one of: auto, aom, rav1e, svt, x265', options.encoder);
1325
+ }
1326
+ }
1320
1327
  } else {
1321
1328
  throw is.invalidParameterError('options', 'Object', options);
1322
1329
  }
package/dist/output.mjs CHANGED
@@ -1317,6 +1317,13 @@ function heif (options) {
1317
1317
  throw is.invalidParameterError('tune', 'one of: psnr, ssim, iq', options.tune);
1318
1318
  }
1319
1319
  }
1320
+ if (is.defined(options.encoder)) {
1321
+ if (is.string(options.encoder) && is.inArray(options.encoder, ['auto', 'aom', 'rav1e', 'svt', 'x265'])) {
1322
+ this.options.heifEncoder = options.encoder;
1323
+ } else {
1324
+ throw is.invalidParameterError('encoder', 'one of: auto, aom, rav1e, svt, x265', options.encoder);
1325
+ }
1326
+ }
1320
1327
  } else {
1321
1328
  throw is.invalidParameterError('options', 'Object', options);
1322
1329
  }
package/lib/index.d.ts CHANGED
@@ -1434,6 +1434,8 @@ declare namespace sharp {
1434
1434
  bitdepth?: 8 | 10 | 12 | undefined;
1435
1435
  /** Tune output for a quality metric, one of 'iq', 'ssim' or 'psnr' (optional, default 'iq') */
1436
1436
  tune?: HeifTune | undefined;
1437
+ /** Which encoder libheif uses (must be compiled in) (optional, default 'auto') */
1438
+ encoder?: 'auto' | 'aom' | 'rav1e' | 'svt' | 'x265' | undefined;
1437
1439
  }
1438
1440
 
1439
1441
  interface HeifOptions extends OutputOptions {
@@ -1451,6 +1453,8 @@ declare namespace sharp {
1451
1453
  bitdepth?: 8 | 10 | 12 | undefined;
1452
1454
  /** Tune output for a quality metric, one of 'ssim', 'psnr' or 'iq' (optional, default 'ssim') */
1453
1455
  tune?: HeifTune | undefined;
1456
+ /** Which encoder libheif uses (must be compiled in) (optional, default 'auto') */
1457
+ encoder?: 'auto' | 'aom' | 'rav1e' | 'svt' | 'x265' | undefined;
1454
1458
  }
1455
1459
 
1456
1460
  interface GifOptions extends OutputOptions, AnimationOptions {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revizly/sharp",
3
3
  "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
4
- "version": "0.35.0-revizly31",
4
+ "version": "0.35.0-revizly32",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://sharp.pixelplumbing.com",
7
7
  "contributors": [
@@ -155,16 +155,16 @@
155
155
  "semver": "^7.7.4"
156
156
  },
157
157
  "optionalDependencies": {
158
- "@revizly/sharp-libvips-linux-arm64": "1.0.34",
159
- "@revizly/sharp-libvips-linux-x64": "1.0.34",
160
- "@revizly/sharp-linux-arm64": "0.35.0-revizly31",
161
- "@revizly/sharp-linux-x64": "0.35.0-revizly31"
158
+ "@revizly/sharp-libvips-linux-arm64": "1.0.35",
159
+ "@revizly/sharp-libvips-linux-x64": "1.0.35",
160
+ "@revizly/sharp-linux-arm64": "0.35.0-revizly32",
161
+ "@revizly/sharp-linux-x64": "0.35.0-revizly32"
162
162
  },
163
163
  "devDependencies": {
164
164
  "@biomejs/biome": "^2.4.13",
165
165
  "@cpplint/cli": "^0.1.0",
166
166
  "@emnapi/runtime": "^1.10.0",
167
- "@revizly/sharp-libvips-dev": "1.0.34",
167
+ "@revizly/sharp-libvips-dev": "1.0.35",
168
168
  "@types/node": "*",
169
169
  "emnapi": "^1.10.0",
170
170
  "exif-reader": "^2.0.3",
package/src/pipeline.cc CHANGED
@@ -1115,6 +1115,7 @@ class PipelineWorker : public Napi::AsyncWorker {
1115
1115
  ->set("effort", baton->heifEffort)
1116
1116
  ->set("bitdepth", baton->heifBitdepth)
1117
1117
  ->set("tune", baton->heifTune.c_str())
1118
+ ->set("encoder", baton->heifEncoder.c_str())
1118
1119
  ->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
1119
1120
  ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
1120
1121
  ->set("lossless", baton->heifLossless)));
@@ -1323,6 +1324,7 @@ class PipelineWorker : public Napi::AsyncWorker {
1323
1324
  ->set("effort", baton->heifEffort)
1324
1325
  ->set("bitdepth", baton->heifBitdepth)
1325
1326
  ->set("tune", baton->heifTune.c_str())
1327
+ ->set("encoder", baton->heifEncoder.c_str())
1326
1328
  ->set("subsample_mode", baton->heifChromaSubsampling == "4:4:4"
1327
1329
  ? VIPS_FOREIGN_SUBSAMPLE_OFF : VIPS_FOREIGN_SUBSAMPLE_ON)
1328
1330
  ->set("lossless", baton->heifLossless));
@@ -1910,6 +1912,7 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
1910
1912
  baton->heifChromaSubsampling = sharp::AttrAsStr(options, "heifChromaSubsampling");
1911
1913
  baton->heifBitdepth = sharp::AttrAsUint32(options, "heifBitdepth");
1912
1914
  baton->heifTune = sharp::AttrAsStr(options, "heifTune");
1915
+ baton->heifEncoder = sharp::AttrAsStr(options, "heifEncoder");
1913
1916
  baton->jxlDistance = sharp::AttrAsDouble(options, "jxlDistance");
1914
1917
  baton->jxlDecodingTier = sharp::AttrAsUint32(options, "jxlDecodingTier");
1915
1918
  baton->jxlEffort = sharp::AttrAsUint32(options, "jxlEffort");
package/src/pipeline.h CHANGED
@@ -198,6 +198,7 @@ struct PipelineBaton {
198
198
  bool heifLossless;
199
199
  int heifBitdepth;
200
200
  std::string heifTune;
201
+ std::string heifEncoder;
201
202
  double jxlDistance;
202
203
  int jxlDecodingTier;
203
204
  int jxlEffort;