sharp 0.29.2 → 0.29.3
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/lib/output.js +2 -0
- package/package.json +5 -5
- package/src/pipeline.cc +9 -2
package/lib/output.js
CHANGED
|
@@ -637,6 +637,8 @@ function trySetAnimationOptions (source, target) {
|
|
|
637
637
|
/**
|
|
638
638
|
* Use these TIFF options for output image.
|
|
639
639
|
*
|
|
640
|
+
* The `density` can be set in pixels/inch via {@link withMetadata} instead of providing `xres` and `yres` in pixels/mm.
|
|
641
|
+
*
|
|
640
642
|
* @example
|
|
641
643
|
* // Convert SVG input to LZW-compressed, 1 bit per pixel TIFF output
|
|
642
644
|
* sharp('input.svg')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sharp",
|
|
3
3
|
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images",
|
|
4
|
-
"version": "0.29.
|
|
4
|
+
"version": "0.29.3",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://github.com/lovell/sharp",
|
|
7
7
|
"contributors": [
|
|
@@ -127,14 +127,14 @@
|
|
|
127
127
|
"color": "^4.0.1",
|
|
128
128
|
"detect-libc": "^1.0.3",
|
|
129
129
|
"node-addon-api": "^4.2.0",
|
|
130
|
-
"prebuild-install": "^
|
|
130
|
+
"prebuild-install": "^7.0.0",
|
|
131
131
|
"semver": "^7.3.5",
|
|
132
|
-
"simple-get": "^
|
|
132
|
+
"simple-get": "^4.0.0",
|
|
133
133
|
"tar-fs": "^2.1.1",
|
|
134
134
|
"tunnel-agent": "^0.6.0"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"async": "^3.2.
|
|
137
|
+
"async": "^3.2.2",
|
|
138
138
|
"cc": "^3.0.1",
|
|
139
139
|
"decompress-zip": "^0.3.3",
|
|
140
140
|
"documentation": "^13.2.5",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"icc": "^2.0.0",
|
|
143
143
|
"license-checker": "^25.0.1",
|
|
144
144
|
"mocha": "^9.1.3",
|
|
145
|
-
"mock-fs": "^5.1.
|
|
145
|
+
"mock-fs": "^5.1.2",
|
|
146
146
|
"nyc": "^15.1.0",
|
|
147
147
|
"prebuild": "^11.0.0",
|
|
148
148
|
"rimraf": "^3.0.2",
|
package/src/pipeline.cc
CHANGED
|
@@ -382,11 +382,15 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
382
382
|
// Ensure shortest edge is at least 1 pixel
|
|
383
383
|
if (image.width() / xfactor < 0.5) {
|
|
384
384
|
xfactor = 2 * image.width();
|
|
385
|
-
baton->
|
|
385
|
+
if (baton->canvas != Canvas::EMBED) {
|
|
386
|
+
baton->width = 1;
|
|
387
|
+
}
|
|
386
388
|
}
|
|
387
389
|
if (image.height() / yfactor < 0.5) {
|
|
388
390
|
yfactor = 2 * image.height();
|
|
389
|
-
baton->
|
|
391
|
+
if (baton->canvas != Canvas::EMBED) {
|
|
392
|
+
baton->height = 1;
|
|
393
|
+
}
|
|
390
394
|
}
|
|
391
395
|
image = image.resize(1.0 / xfactor, VImage::option()
|
|
392
396
|
->set("vscale", 1.0 / yfactor)
|
|
@@ -1492,6 +1496,9 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
|
|
|
1492
1496
|
baton->tiffTileHeight = sharp::AttrAsUint32(options, "tiffTileHeight");
|
|
1493
1497
|
baton->tiffXres = sharp::AttrAsDouble(options, "tiffXres");
|
|
1494
1498
|
baton->tiffYres = sharp::AttrAsDouble(options, "tiffYres");
|
|
1499
|
+
if (baton->tiffXres == 1.0 && baton->tiffYres == 1.0 && baton->withMetadataDensity > 0) {
|
|
1500
|
+
baton->tiffXres = baton->tiffYres = baton->withMetadataDensity / 25.4;
|
|
1501
|
+
}
|
|
1495
1502
|
// tiff compression options
|
|
1496
1503
|
baton->tiffCompression = static_cast<VipsForeignTiffCompression>(
|
|
1497
1504
|
vips_enum_from_nick(nullptr, VIPS_TYPE_FOREIGN_TIFF_COMPRESSION,
|