@revizly/sharp 0.35.0-revizly56 → 0.35.0-revizly57

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.
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-revizly56",
4
+ "version": "0.35.0-revizly57",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://sharp.pixelplumbing.com",
7
7
  "contributors": [
@@ -164,10 +164,10 @@
164
164
  "semver": "^7.8.5"
165
165
  },
166
166
  "optionalDependencies": {
167
- "@revizly/sharp-libvips-linux-arm64": "1.0.56",
168
- "@revizly/sharp-libvips-linux-x64": "1.0.56",
169
- "@revizly/sharp-linux-arm64": "0.35.0-revizly56",
170
- "@revizly/sharp-linux-x64": "0.35.0-revizly56"
167
+ "@revizly/sharp-libvips-linux-arm64": "1.0.57",
168
+ "@revizly/sharp-libvips-linux-x64": "1.0.57",
169
+ "@revizly/sharp-linux-arm64": "0.35.0-revizly57",
170
+ "@revizly/sharp-linux-x64": "0.35.0-revizly57"
171
171
  },
172
172
  "peerDependenciesMeta": {
173
173
  "@types/node": {
@@ -178,7 +178,7 @@
178
178
  "@biomejs/biome": "^2.5.15",
179
179
  "@cpplint/cli": "^0.1.0",
180
180
  "@emnapi/runtime": "^1.11.3",
181
- "@revizly/sharp-libvips-dev": "1.0.56",
181
+ "@revizly/sharp-libvips-dev": "1.0.57",
182
182
  "@types/node": "*",
183
183
  "cspell": "^10.4.0",
184
184
  "emnapi": "^1.11.3",
@@ -196,7 +196,7 @@
196
196
  "node": ">=20.9.0"
197
197
  },
198
198
  "config": {
199
- "libvips": ">=8.18.7"
199
+ "libvips": ">=8.19.0"
200
200
  },
201
201
  "funding": {
202
202
  "url": "https://opencollective.com/libvips"
package/src/common.cc CHANGED
@@ -431,7 +431,9 @@ namespace sharp {
431
431
  }
432
432
  switch (imageType) {
433
433
  case ImageType::SVG:
434
+ // libvips 8.19+ only uses dpi for physical units, so scale to render at the requested density
434
435
  option->set("dpi", descriptor->density)
436
+ ->set("scale", descriptor->density / 72.0)
435
437
  ->set("stylesheet", descriptor->svgStylesheet.data())
436
438
  ->set("high_bitdepth", descriptor->svgHighBitdepth);
437
439
  break;
package/src/common.h CHANGED
@@ -18,9 +18,9 @@
18
18
  // Verify platform and compiler compatibility
19
19
 
20
20
  #if (VIPS_MAJOR_VERSION < 8) || \
21
- (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 18) || \
22
- (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 18 && VIPS_MICRO_VERSION < 7)
23
- #error "libvips version 8.18.7+ is required - please see https://sharp.pixelplumbing.com/install"
21
+ (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 19) || \
22
+ (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 19 && VIPS_MICRO_VERSION < 0)
23
+ #error "libvips version 8.19.0+ is required - please see https://sharp.pixelplumbing.com/install"
24
24
  #endif
25
25
 
26
26
  #if defined(__has_include)
package/src/pipeline.cc CHANGED
@@ -282,7 +282,9 @@ class PipelineWorker : public Napi::AsyncWorker {
282
282
  image = VImage::jpegload(const_cast<char*>(baton->input->file.data()), option);
283
283
  }
284
284
  } else if (scale != 1.0) {
285
- vips::VOption *option = GetOptionsForImageType(inputImageType, baton->input)->set("scale", scale);
285
+ // SVG scale is relative to the density-scaled size of the original input
286
+ const double loadScale = inputImageType == sharp::ImageType::SVG ? scale * baton->input->density / 72.0 : scale;
287
+ vips::VOption *option = GetOptionsForImageType(inputImageType, baton->input)->set("scale", loadScale);
286
288
  if (inputImageType == sharp::ImageType::WEBP) {
287
289
  if (baton->input->buffer != nullptr) {
288
290
  // Reload WebP buffer