Upgrade to libvips 8.10.0-beta2

This commit is contained in:
Lovell Fuller 2020-07-14 11:10:20 +01:00
parent ba17db3ab3
commit 3150fad909
18 changed files with 627 additions and 498 deletions

View File

@ -95,7 +95,7 @@
'src/sharp.cc' 'src/sharp.cc'
], ],
'include_dirs': [ 'include_dirs': [
'<!@(node -p "require(\'node-addon-api\').include")', '<!(node -p "require(\'node-addon-api\').include")',
], ],
'conditions': [ 'conditions': [
['use_global_libvips == "true"', { ['use_global_libvips == "true"', {

View File

@ -147,7 +147,7 @@ Some of these options require the use of a globally-installed libvips compiled w
- `options` **[Object][6]?** output options - `options` **[Object][6]?** output options
- `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`) - `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`)
- `options.progressive` **[boolean][7]** use progressive (interlace) scan (optional, default `false`) - `options.progressive` **[boolean][7]** use progressive (interlace) scan (optional, default `false`)
- `options.chromaSubsampling` **[string][2]** for quality &lt; 90, set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' (use chroma subsampling); for quality >= 90 chroma is never subsampled (optional, default `'4:2:0'`) - `options.chromaSubsampling` **[string][2]** set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling (optional, default `'4:2:0'`)
- `options.optimiseCoding` **[boolean][7]** optimise Huffman coding tables (optional, default `true`) - `options.optimiseCoding` **[boolean][7]** optimise Huffman coding tables (optional, default `true`)
- `options.optimizeCoding` **[boolean][7]** alternative spelling of optimiseCoding (optional, default `true`) - `options.optimizeCoding` **[boolean][7]** alternative spelling of optimiseCoding (optional, default `true`)
- `options.trellisQuantisation` **[boolean][7]** apply trellis quantisation, requires libvips compiled with support for mozjpeg (optional, default `false`) - `options.trellisQuantisation` **[boolean][7]** apply trellis quantisation, requires libvips compiled with support for mozjpeg (optional, default `false`)
@ -254,7 +254,7 @@ Use these TIFF options for output image.
- `options.tileHeight` **[boolean][7]** vertical tile size (optional, default `256`) - `options.tileHeight` **[boolean][7]** vertical tile size (optional, default `256`)
- `options.xres` **[number][9]** horizontal resolution in pixels/mm (optional, default `1.0`) - `options.xres` **[number][9]** horizontal resolution in pixels/mm (optional, default `1.0`)
- `options.yres` **[number][9]** vertical resolution in pixels/mm (optional, default `1.0`) - `options.yres` **[number][9]** vertical resolution in pixels/mm (optional, default `1.0`)
- `options.squash` **[boolean][7]** squash 8-bit images down to 1 bit (optional, default `false`) - `options.bitdepth` **[boolean][7]** reduce bitdepth to 1, 2 or 4 bit (optional, default `8`)
### Examples ### Examples
@ -263,7 +263,7 @@ Use these TIFF options for output image.
sharp('input.svg') sharp('input.svg')
.tiff({ .tiff({
compression: 'lzw', compression: 'lzw',
squash: true bitdepth: 1
}) })
.toFile('1-bpp-output.tiff') .toFile('1-bpp-output.tiff')
.then(info => { ... }); .then(info => { ... });

View File

@ -2,12 +2,16 @@
## v0.26 - *zoom* ## v0.26 - *zoom*
Requires libvips v8.9.2 Requires libvips v8.10.0
### v0.26.0 - TBD ### v0.26.0 - TBD
* Prebuilt libvips binaries are now statically-linked and Brotli-compressed, requiring Node.js 10.16.0+. * Prebuilt libvips binaries are now statically-linked and Brotli-compressed, requiring Node.js 10.16.0+.
* TIFF output `squash` is replaced by `bitdepth` to reduce to 1, 2 or 4 bit.
* JPEG output `quality` >= 90 no longer automatically sets `chromaSubsampling` to `4:4:4`.
## v0.25 - *yield* ## v0.25 - *yield*
Requires libvips v8.9.1 Requires libvips v8.9.1

File diff suppressed because one or more lines are too long

View File

@ -81,7 +81,7 @@ try {
} }
} }
// Download to per-process temporary file // Download to per-process temporary file
const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.br'; const tarFilename = ['libvips', minimumLibvipsVersionLabelled, platformAndArch].join('-') + '.tar.br';
const tarPathCache = path.join(libvips.cachePath(), tarFilename); const tarPathCache = path.join(libvips.cachePath(), tarFilename);
if (fs.existsSync(tarPathCache)) { if (fs.existsSync(tarPathCache)) {
npmLog.info('sharp', `Using cached ${tarPathCache}`); npmLog.info('sharp', `Using cached ${tarPathCache}`);

View File

@ -214,7 +214,7 @@ const Sharp = function (input, options) {
tiffCompression: 'jpeg', tiffCompression: 'jpeg',
tiffPredictor: 'horizontal', tiffPredictor: 'horizontal',
tiffPyramid: false, tiffPyramid: false,
tiffSquash: false, tiffBitdepth: 8,
tiffTile: false, tiffTile: false,
tiffTileHeight: 256, tiffTileHeight: 256,
tiffTileWidth: 256, tiffTileWidth: 256,

View File

@ -187,7 +187,7 @@ function toFormat (format, options) {
* @param {Object} [options] - output options * @param {Object} [options] - output options
* @param {number} [options.quality=80] - quality, integer 1-100 * @param {number} [options.quality=80] - quality, integer 1-100
* @param {boolean} [options.progressive=false] - use progressive (interlace) scan * @param {boolean} [options.progressive=false] - use progressive (interlace) scan
* @param {string} [options.chromaSubsampling='4:2:0'] - for quality < 90, set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' (use chroma subsampling); for quality >= 90 chroma is never subsampled * @param {string} [options.chromaSubsampling='4:2:0'] - set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' chroma subsampling
* @param {boolean} [options.optimiseCoding=true] - optimise Huffman coding tables * @param {boolean} [options.optimiseCoding=true] - optimise Huffman coding tables
* @param {boolean} [options.optimizeCoding=true] - alternative spelling of optimiseCoding * @param {boolean} [options.optimizeCoding=true] - alternative spelling of optimiseCoding
* @param {boolean} [options.trellisQuantisation=false] - apply trellis quantisation, requires libvips compiled with support for mozjpeg * @param {boolean} [options.trellisQuantisation=false] - apply trellis quantisation, requires libvips compiled with support for mozjpeg
@ -386,7 +386,7 @@ function webp (options) {
* sharp('input.svg') * sharp('input.svg')
* .tiff({ * .tiff({
* compression: 'lzw', * compression: 'lzw',
* squash: true * bitdepth: 1
* }) * })
* .toFile('1-bpp-output.tiff') * .toFile('1-bpp-output.tiff')
* .then(info => { ... }); * .then(info => { ... });
@ -402,7 +402,7 @@ function webp (options) {
* @param {boolean} [options.tileHeight=256] - vertical tile size * @param {boolean} [options.tileHeight=256] - vertical tile size
* @param {number} [options.xres=1.0] - horizontal resolution in pixels/mm * @param {number} [options.xres=1.0] - horizontal resolution in pixels/mm
* @param {number} [options.yres=1.0] - vertical resolution in pixels/mm * @param {number} [options.yres=1.0] - vertical resolution in pixels/mm
* @param {boolean} [options.squash=false] - squash 8-bit images down to 1 bit * @param {boolean} [options.bitdepth=8] - reduce bitdepth to 1, 2 or 4 bit
* @returns {Sharp} * @returns {Sharp}
* @throws {Error} Invalid options * @throws {Error} Invalid options
*/ */
@ -415,8 +415,12 @@ function tiff (options) {
throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality); throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
} }
} }
if (is.defined(options.squash)) { if (is.defined(options.bitdepth)) {
this._setBooleanOption('tiffSquash', options.squash); if (is.integer(options.bitdepth) && is.inArray(options.bitdepth, [1, 2, 4, 8])) {
this.options.tiffBitdepth = options.bitdepth;
} else {
throw is.invalidParameterError('bitdepth', '1, 2, 4 or 8', options.bitdepth);
}
} }
// tiling // tiling
if (is.defined(options.tile)) { if (is.defined(options.tile)) {

View File

@ -111,9 +111,9 @@
"dependencies": { "dependencies": {
"color": "^3.1.2", "color": "^3.1.2",
"detect-libc": "^1.0.3", "detect-libc": "^1.0.3",
"node-addon-api": "^3.0.0", "node-addon-api": "^3.0.1",
"npmlog": "^4.1.2", "npmlog": "^4.1.2",
"prebuild-install": "^5.3.4", "prebuild-install": "^5.3.5",
"semver": "^7.3.2", "semver": "^7.3.2",
"simple-get": "^4.0.0", "simple-get": "^4.0.0",
"tar-fs": "^2.1.0", "tar-fs": "^2.1.0",
@ -123,9 +123,9 @@
"async": "^3.2.0", "async": "^3.2.0",
"cc": "^2.0.1", "cc": "^2.0.1",
"decompress-zip": "^0.3.2", "decompress-zip": "^0.3.2",
"documentation": "^13.0.1", "documentation": "^13.0.2",
"exif-reader": "^1.0.3", "exif-reader": "^1.0.3",
"icc": "^1.0.0", "icc": "^2.0.0",
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
"mocha": "^8.0.1", "mocha": "^8.0.1",
"mock-fs": "^4.12.0", "mock-fs": "^4.12.0",
@ -137,7 +137,7 @@
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"config": { "config": {
"libvips": "8.9.2-alpha5" "libvips": "8.10.0-beta2"
}, },
"engines": { "engines": {
"node": ">=10.16.0" "node": ">=10.16.0"

View File

@ -243,7 +243,7 @@ namespace sharp {
imageType = ImageType::MAGICK; imageType = ImageType::MAGICK;
} }
} else { } else {
if (EndsWith(vips::VError().what(), " not found\n")) { if (EndsWith(vips::VError().what(), " does not exist\n")) {
imageType = ImageType::MISSING; imageType = ImageType::MISSING;
} }
} }

View File

@ -413,7 +413,8 @@ VOption::set_operation( VipsOperation *operation )
#ifdef VIPS_DEBUG_VERBOSE #ifdef VIPS_DEBUG_VERBOSE
printf( "set_operation: " ); printf( "set_operation: " );
vips_object_print_name( VIPS_OBJECT( operation ) ); vips_object_print_name( VIPS_OBJECT( operation ) );
char *str_value = g_strdup_value_contents( &(*i)->value ); char *str_value =
g_strdup_value_contents( &(*i)->value );
printf( ".%s = %s\n", (*i)->name, str_value ); printf( ".%s = %s\n", (*i)->name, str_value );
g_free( str_value ); g_free( str_value );
#endif /*VIPS_DEBUG_VERBOSE*/ #endif /*VIPS_DEBUG_VERBOSE*/

View File

@ -1,5 +1,5 @@
// bodies for vips operations // bodies for vips operations
// Wed 01 Jan 2020 12:22:12 PM CET // Sun 5 Jul 22:36:37 BST 2020
// this file is generated automatically, do not edit! // this file is generated automatically, do not edit!
VImage VImage::CMC2LCh( VOption *options ) const VImage VImage::CMC2LCh( VOption *options ) const
@ -754,6 +754,18 @@ VImage VImage::csvload( const char *filename, VOption *options )
return( out ); return( out );
} }
VImage VImage::csvload_source( VSource source, VOption *options )
{
VImage out;
call( "csvload_source",
(options ? options : VImage::option())->
set( "out", &out )->
set( "source", source ) );
return( out );
}
void VImage::csvsave( const char *filename, VOption *options ) const void VImage::csvsave( const char *filename, VOption *options ) const
{ {
call( "csvsave", call( "csvsave",
@ -762,6 +774,14 @@ void VImage::csvsave( const char *filename, VOption *options ) const
set( "filename", filename ) ); set( "filename", filename ) );
} }
void VImage::csvsave_target( VTarget target, VOption *options ) const
{
call( "csvsave_target",
(options ? options : VImage::option())->
set( "in", *this )->
set( "target", target ) );
}
VImage VImage::dE00( VImage right, VOption *options ) const VImage VImage::dE00( VImage right, VOption *options ) const
{ {
VImage out; VImage out;
@ -1218,6 +1238,18 @@ VImage VImage::gifload_buffer( VipsBlob *buffer, VOption *options )
return( out ); return( out );
} }
VImage VImage::gifload_source( VSource source, VOption *options )
{
VImage out;
call( "gifload_source",
(options ? options : VImage::option())->
set( "out", &out )->
set( "source", source ) );
return( out );
}
VImage VImage::globalbalance( VOption *options ) const VImage VImage::globalbalance( VOption *options ) const
{ {
VImage out; VImage out;
@ -1297,6 +1329,18 @@ VImage VImage::heifload_buffer( VipsBlob *buffer, VOption *options )
return( out ); return( out );
} }
VImage VImage::heifload_source( VSource source, VOption *options )
{
VImage out;
call( "heifload_source",
(options ? options : VImage::option())->
set( "out", &out )->
set( "source", source ) );
return( out );
}
void VImage::heifsave( const char *filename, VOption *options ) const void VImage::heifsave( const char *filename, VOption *options ) const
{ {
call( "heifsave", call( "heifsave",
@ -1317,6 +1361,14 @@ VipsBlob *VImage::heifsave_buffer( VOption *options ) const
return( buffer ); return( buffer );
} }
void VImage::heifsave_target( VTarget target, VOption *options ) const
{
call( "heifsave_target",
(options ? options : VImage::option())->
set( "in", *this )->
set( "target", target ) );
}
VImage VImage::hist_cum( VOption *options ) const VImage VImage::hist_cum( VOption *options ) const
{ {
VImage out; VImage out;
@ -2028,6 +2080,18 @@ VImage VImage::matload( const char *filename, VOption *options )
return( out ); return( out );
} }
VImage VImage::matrixinvert( VOption *options ) const
{
VImage out;
call( "matrixinvert",
(options ? options : VImage::option())->
set( "in", *this )->
set( "out", &out ) );
return( out );
}
VImage VImage::matrixload( const char *filename, VOption *options ) VImage VImage::matrixload( const char *filename, VOption *options )
{ {
VImage out; VImage out;
@ -2040,6 +2104,18 @@ VImage VImage::matrixload( const char *filename, VOption *options )
return( out ); return( out );
} }
VImage VImage::matrixload_source( VSource source, VOption *options )
{
VImage out;
call( "matrixload_source",
(options ? options : VImage::option())->
set( "out", &out )->
set( "source", source ) );
return( out );
}
void VImage::matrixprint( VOption *options ) const void VImage::matrixprint( VOption *options ) const
{ {
call( "matrixprint", call( "matrixprint",
@ -2055,6 +2131,14 @@ void VImage::matrixsave( const char *filename, VOption *options ) const
set( "filename", filename ) ); set( "filename", filename ) );
} }
void VImage::matrixsave_target( VTarget target, VOption *options ) const
{
call( "matrixsave_target",
(options ? options : VImage::option())->
set( "in", *this )->
set( "target", target ) );
}
double VImage::max( VOption *options ) const double VImage::max( VOption *options ) const
{ {
double out; double out;
@ -2256,6 +2340,18 @@ VImage VImage::pdfload_buffer( VipsBlob *buffer, VOption *options )
return( out ); return( out );
} }
VImage VImage::pdfload_source( VSource source, VOption *options )
{
VImage out;
call( "pdfload_source",
(options ? options : VImage::option())->
set( "out", &out )->
set( "source", source ) );
return( out );
}
int VImage::percent( double percent, VOption *options ) const int VImage::percent( double percent, VOption *options ) const
{ {
int threshold; int threshold;
@ -2371,6 +2467,18 @@ VImage VImage::ppmload( const char *filename, VOption *options )
return( out ); return( out );
} }
VImage VImage::ppmload_source( VSource source, VOption *options )
{
VImage out;
call( "ppmload_source",
(options ? options : VImage::option())->
set( "out", &out )->
set( "source", source ) );
return( out );
}
void VImage::ppmsave( const char *filename, VOption *options ) const void VImage::ppmsave( const char *filename, VOption *options ) const
{ {
call( "ppmsave", call( "ppmsave",
@ -2379,6 +2487,14 @@ void VImage::ppmsave( const char *filename, VOption *options ) const
set( "filename", filename ) ); set( "filename", filename ) );
} }
void VImage::ppmsave_target( VTarget target, VOption *options ) const
{
call( "ppmsave_target",
(options ? options : VImage::option())->
set( "in", *this )->
set( "target", target ) );
}
VImage VImage::premultiply( VOption *options ) const VImage VImage::premultiply( VOption *options ) const
{ {
VImage out; VImage out;

View File

@ -703,7 +703,9 @@ class PipelineWorker : public Napi::AsyncWorker {
->set("strip", !baton->withMetadata) ->set("strip", !baton->withMetadata)
->set("Q", baton->jpegQuality) ->set("Q", baton->jpegQuality)
->set("interlace", baton->jpegProgressive) ->set("interlace", baton->jpegProgressive)
->set("no_subsample", baton->jpegChromaSubsampling == "4:4:4") ->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
? VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
: VIPS_FOREIGN_JPEG_SUBSAMPLE_ON)
->set("trellis_quant", baton->jpegTrellisQuantisation) ->set("trellis_quant", baton->jpegTrellisQuantisation)
->set("quant_table", baton->jpegQuantisationTable) ->set("quant_table", baton->jpegQuantisationTable)
->set("overshoot_deringing", baton->jpegOvershootDeringing) ->set("overshoot_deringing", baton->jpegOvershootDeringing)
@ -769,7 +771,7 @@ class PipelineWorker : public Napi::AsyncWorker {
VipsArea *area = VIPS_AREA(image.tiffsave_buffer(VImage::option() VipsArea *area = VIPS_AREA(image.tiffsave_buffer(VImage::option()
->set("strip", !baton->withMetadata) ->set("strip", !baton->withMetadata)
->set("Q", baton->tiffQuality) ->set("Q", baton->tiffQuality)
->set("squash", baton->tiffSquash) ->set("bitdepth", baton->tiffBitdepth)
->set("compression", baton->tiffCompression) ->set("compression", baton->tiffCompression)
->set("predictor", baton->tiffPredictor) ->set("predictor", baton->tiffPredictor)
->set("pyramid", baton->tiffPyramid) ->set("pyramid", baton->tiffPyramid)
@ -845,7 +847,9 @@ class PipelineWorker : public Napi::AsyncWorker {
->set("strip", !baton->withMetadata) ->set("strip", !baton->withMetadata)
->set("Q", baton->jpegQuality) ->set("Q", baton->jpegQuality)
->set("interlace", baton->jpegProgressive) ->set("interlace", baton->jpegProgressive)
->set("no_subsample", baton->jpegChromaSubsampling == "4:4:4") ->set("subsample_mode", baton->jpegChromaSubsampling == "4:4:4"
? VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
: VIPS_FOREIGN_JPEG_SUBSAMPLE_ON)
->set("trellis_quant", baton->jpegTrellisQuantisation) ->set("trellis_quant", baton->jpegTrellisQuantisation)
->set("quant_table", baton->jpegQuantisationTable) ->set("quant_table", baton->jpegQuantisationTable)
->set("overshoot_deringing", baton->jpegOvershootDeringing) ->set("overshoot_deringing", baton->jpegOvershootDeringing)
@ -891,7 +895,7 @@ class PipelineWorker : public Napi::AsyncWorker {
image.tiffsave(const_cast<char*>(baton->fileOut.data()), VImage::option() image.tiffsave(const_cast<char*>(baton->fileOut.data()), VImage::option()
->set("strip", !baton->withMetadata) ->set("strip", !baton->withMetadata)
->set("Q", baton->tiffQuality) ->set("Q", baton->tiffQuality)
->set("squash", baton->tiffSquash) ->set("bitdepth", baton->tiffBitdepth)
->set("compression", baton->tiffCompression) ->set("compression", baton->tiffCompression)
->set("predictor", baton->tiffPredictor) ->set("predictor", baton->tiffPredictor)
->set("pyramid", baton->tiffPyramid) ->set("pyramid", baton->tiffPyramid)
@ -940,7 +944,7 @@ class PipelineWorker : public Napi::AsyncWorker {
std::vector<std::pair<std::string, std::string>> options { std::vector<std::pair<std::string, std::string>> options {
{"Q", std::to_string(baton->jpegQuality)}, {"Q", std::to_string(baton->jpegQuality)},
{"interlace", baton->jpegProgressive ? "TRUE" : "FALSE"}, {"interlace", baton->jpegProgressive ? "TRUE" : "FALSE"},
{"no_subsample", baton->jpegChromaSubsampling == "4:4:4" ? "TRUE": "FALSE"}, {"subsample_mode", baton->jpegChromaSubsampling == "4:4:4" ? "off" : "on"},
{"trellis_quant", baton->jpegTrellisQuantisation ? "TRUE" : "FALSE"}, {"trellis_quant", baton->jpegTrellisQuantisation ? "TRUE" : "FALSE"},
{"quant_table", std::to_string(baton->jpegQuantisationTable)}, {"quant_table", std::to_string(baton->jpegQuantisationTable)},
{"overshoot_deringing", baton->jpegOvershootDeringing ? "TRUE": "FALSE"}, {"overshoot_deringing", baton->jpegOvershootDeringing ? "TRUE": "FALSE"},
@ -1306,7 +1310,7 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
baton->webpReductionEffort = sharp::AttrAsUint32(options, "webpReductionEffort"); baton->webpReductionEffort = sharp::AttrAsUint32(options, "webpReductionEffort");
baton->tiffQuality = sharp::AttrAsUint32(options, "tiffQuality"); baton->tiffQuality = sharp::AttrAsUint32(options, "tiffQuality");
baton->tiffPyramid = sharp::AttrAsBool(options, "tiffPyramid"); baton->tiffPyramid = sharp::AttrAsBool(options, "tiffPyramid");
baton->tiffSquash = sharp::AttrAsBool(options, "tiffSquash"); baton->tiffBitdepth = sharp::AttrAsUint32(options, "tiffBitdepth");
baton->tiffTile = sharp::AttrAsBool(options, "tiffTile"); baton->tiffTile = sharp::AttrAsBool(options, "tiffTile");
baton->tiffTileWidth = sharp::AttrAsUint32(options, "tiffTileWidth"); baton->tiffTileWidth = sharp::AttrAsUint32(options, "tiffTileWidth");
baton->tiffTileHeight = sharp::AttrAsUint32(options, "tiffTileHeight"); baton->tiffTileHeight = sharp::AttrAsUint32(options, "tiffTileHeight");

View File

@ -143,7 +143,7 @@ struct PipelineBaton {
VipsForeignTiffCompression tiffCompression; VipsForeignTiffCompression tiffCompression;
VipsForeignTiffPredictor tiffPredictor; VipsForeignTiffPredictor tiffPredictor;
bool tiffPyramid; bool tiffPyramid;
bool tiffSquash; int tiffBitdepth;
bool tiffTile; bool tiffTile;
int tiffTileHeight; int tiffTileHeight;
int tiffTileWidth; int tiffTileWidth;
@ -251,7 +251,7 @@ struct PipelineBaton {
tiffCompression(VIPS_FOREIGN_TIFF_COMPRESSION_JPEG), tiffCompression(VIPS_FOREIGN_TIFF_COMPRESSION_JPEG),
tiffPredictor(VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL), tiffPredictor(VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL),
tiffPyramid(false), tiffPyramid(false),
tiffSquash(false), tiffBitdepth(8),
tiffTile(false), tiffTile(false),
tiffTileHeight(256), tiffTileHeight(256),
tiffTileWidth(256), tiffTileWidth(256),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -23,7 +23,7 @@ describe('failOnError', function () {
let isWarningEmitted = false; let isWarningEmitted = false;
sharp(fixtures.inputPngTruncated, { failOnError: false }) sharp(fixtures.inputPngTruncated, { failOnError: false })
.on('warning', function (warning) { .on('warning', function (warning) {
assert.strictEqual('not enough data', warning); assert.ok(warning.includes('not enough data') || warning.includes('end of stream'));
isWarningEmitted = true; isWarningEmitted = true;
}) })
.resize(320, 240) .resize(320, 240)
@ -62,7 +62,7 @@ describe('failOnError', function () {
it('returns errors to callback for truncated PNG', function (done) { it('returns errors to callback for truncated PNG', function (done) {
sharp(fixtures.inputPngTruncated).toBuffer(function (err, data, info) { sharp(fixtures.inputPngTruncated).toBuffer(function (err, data, info) {
assert.ok(err.message.includes('vipspng: libpng read error'), err); assert.ok(err.message.includes('read error'), err);
assert.strictEqual(data, undefined); assert.strictEqual(data, undefined);
assert.strictEqual(info, undefined); assert.strictEqual(info, undefined);
done(); done();

View File

@ -116,7 +116,7 @@ describe('TIFF', function () {
sharp(fixtures.inputTiff8BitDepth) sharp(fixtures.inputTiff8BitDepth)
.toColourspace('b-w') // can only squash 1 band uchar images .toColourspace('b-w') // can only squash 1 band uchar images
.tiff({ .tiff({
squash: false, bitdepth: 8,
compression: 'none', compression: 'none',
predictor: 'none' predictor: 'none'
}) })
@ -133,7 +133,7 @@ describe('TIFF', function () {
sharp(fixtures.inputTiff8BitDepth) sharp(fixtures.inputTiff8BitDepth)
.toColourspace('b-w') // can only squash 1 band uchar images .toColourspace('b-w') // can only squash 1 band uchar images
.tiff({ .tiff({
squash: true, bitdepth: 1,
compression: 'none', compression: 'none',
predictor: 'none' predictor: 'none'
}) })
@ -145,10 +145,10 @@ describe('TIFF', function () {
}); });
}); });
it('Invalid TIFF squash value throws error', function () { it('Invalid TIFF bitdepth value throws error', function () {
assert.throws(function () { assert.throws(function () {
sharp().tiff({ squash: 'true' }); sharp().tiff({ bitdepth: 3 });
}); }, /Error: Expected 1, 2, 4 or 8 for bitdepth but received 3 of type number/);
}); });
it('TIFF setting xres and yres on file', () => it('TIFF setting xres and yres on file', () =>
@ -255,7 +255,7 @@ describe('TIFF', function () {
sharp(fixtures.inputTiff) sharp(fixtures.inputTiff)
.toColourspace('b-w') .toColourspace('b-w')
.tiff({ .tiff({
squash: true, bitdepth: 1,
compression: 'ccittfax4' compression: 'ccittfax4'
}) })
.toFile(fixtures.outputTiff, (err, info) => { .toFile(fixtures.outputTiff, (err, info) => {