mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Upgrade to libvips v8.13.0-rc1 (#3230)
* Switch from decompress-zip to extract-zip The former seems to hang when unzipping a ZIP64 file that uses the general purpose bit flag 3 as file entry. See: https://github.com/thejoshwolfe/yauzl#no-streaming-unzip-api * Prefer to call via static member instead Makes it clearer that a static method is being called. * `flatten-orange.jpg`: save without chroma subsampling To ensure no down-scaling of the Cr/Cb channels.
This commit is contained in:
committed by
GitHub
parent
e40a881ab4
commit
afc4c5bf79
@@ -23,6 +23,7 @@ describe('Alpha transparency', function () {
|
||||
.flatten({
|
||||
background: { r: 255, g: 102, b: 0 }
|
||||
})
|
||||
.jpeg({ chromaSubsampling: '4:4:4' })
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(400, info.width);
|
||||
@@ -35,6 +36,7 @@ describe('Alpha transparency', function () {
|
||||
sharp(fixtures.inputPngWithTransparency)
|
||||
.resize(400, 300)
|
||||
.flatten({ background: '#ff6600' })
|
||||
.jpeg({ chromaSubsampling: '4:4:4' })
|
||||
.toBuffer(function (err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(400, info.width);
|
||||
|
||||
@@ -27,7 +27,9 @@ describe('AVIF', () => {
|
||||
format: 'jpeg',
|
||||
hasAlpha: false,
|
||||
hasProfile: false,
|
||||
height: 14,
|
||||
// 32 / (2048 / 858) = 13.40625
|
||||
// Math.round(13.40625) = 13
|
||||
height: 13,
|
||||
isProgressive: false,
|
||||
space: 'srgb',
|
||||
width: 32
|
||||
@@ -70,7 +72,11 @@ describe('AVIF', () => {
|
||||
format: 'heif',
|
||||
hasAlpha: false,
|
||||
hasProfile: false,
|
||||
height: 14,
|
||||
// FIXME(kleisauke): https://github.com/strukturag/libheif/issues/365
|
||||
// $ vips black x.avif 32 13
|
||||
// $ vipsheader x.avif
|
||||
// x.avif: 32x12 uchar, 3 bands, srgb, heifload
|
||||
height: 12,
|
||||
isProgressive: false,
|
||||
pagePrimary: 0,
|
||||
pages: 1,
|
||||
|
||||
@@ -5,11 +5,9 @@ const sharp = require('../../');
|
||||
|
||||
const libcFamily = detectLibc.familySync();
|
||||
const usingCache = libcFamily !== detectLibc.MUSL;
|
||||
const usingSimd = !process.env.G_DEBUG;
|
||||
const concurrency =
|
||||
libcFamily === detectLibc.MUSL || process.arch === 'arm'
|
||||
? 1
|
||||
: undefined;
|
||||
const usingSimd = !(process.env.G_DEBUG || process.env.VIPS_NOVECTOR);
|
||||
const concurrency = process.env.VIPS_CONCURRENCY ||
|
||||
(libcFamily === detectLibc.MUSL || process.arch === 'arm' ? 1 : undefined);
|
||||
|
||||
beforeEach(function () {
|
||||
sharp.cache(usingCache);
|
||||
|
||||
@@ -343,7 +343,7 @@ describe('Image metadata', function () {
|
||||
assert.strictEqual(depth, 'uchar');
|
||||
assert.strictEqual(isProgressive, false);
|
||||
assert.strictEqual(pages, 10);
|
||||
assert.strictEqual(loop, 2);
|
||||
assert.strictEqual(loop, 3);
|
||||
assert.deepStrictEqual(delay, [...Array(9).fill(3000), 15000]);
|
||||
assert.strictEqual(hasProfile, false);
|
||||
assert.strictEqual(hasAlpha, true);
|
||||
|
||||
@@ -6,7 +6,7 @@ const assert = require('assert');
|
||||
|
||||
const eachLimit = require('async/eachLimit');
|
||||
const rimraf = require('rimraf');
|
||||
const DecompressZip = require('decompress-zip');
|
||||
const extractZip = require('extract-zip');
|
||||
|
||||
const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
@@ -14,7 +14,8 @@ const fixtures = require('../fixtures');
|
||||
// Verifies all tiles in a given dz output directory are <= size
|
||||
const assertDeepZoomTiles = function (directory, expectedSize, expectedLevels, done) {
|
||||
// Get levels
|
||||
const levels = fs.readdirSync(directory);
|
||||
const dirents = fs.readdirSync(directory, { withFileTypes: true });
|
||||
const levels = dirents.filter(dirent => dirent.isDirectory()).map(dirent => dirent.name);
|
||||
assert.strictEqual(expectedLevels, levels.length);
|
||||
// Get tiles
|
||||
const tiles = [];
|
||||
@@ -67,8 +68,10 @@ const assertZoomifyTiles = function (directory, expectedTileSize, expectedLevels
|
||||
};
|
||||
|
||||
const assertGoogleTiles = function (directory, expectedTileSize, expectedLevels, done) {
|
||||
const levels = fs.readdirSync(directory);
|
||||
assert.strictEqual(expectedLevels, levels.length - 1); // subtract one to account for default blank tile
|
||||
// Get levels
|
||||
const dirents = fs.readdirSync(directory, { withFileTypes: true });
|
||||
const levels = dirents.filter(dirent => dirent.isDirectory()).map(dirent => dirent.name);
|
||||
assert.strictEqual(expectedLevels, levels.length);
|
||||
|
||||
fs.stat(path.join(directory, 'blank.png'), function (err, stat) {
|
||||
if (err) throw err;
|
||||
@@ -94,7 +97,8 @@ const assertGoogleTiles = function (directory, expectedTileSize, expectedLevels,
|
||||
// Verifies tiles at specified level in a given output directory are > size+overlap
|
||||
const assertTileOverlap = function (directory, tileSize, done) {
|
||||
// Get sorted levels
|
||||
const levels = fs.readdirSync(directory).sort((a, b) => a - b);
|
||||
const dirents = fs.readdirSync(directory, { withFileTypes: true });
|
||||
const levels = dirents.filter(dirent => dirent.isDirectory()).map(dirent => dirent.name).sort((a, b) => a - b);
|
||||
// Select the highest tile level
|
||||
const highestLevel = levels[levels.length - 1];
|
||||
// Get sorted tiles from greatest level
|
||||
@@ -908,14 +912,10 @@ describe('Tile', function () {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, stat.isFile());
|
||||
assert.strictEqual(true, stat.size > 0);
|
||||
new DecompressZip(container)
|
||||
.on('extract', function () {
|
||||
extractZip(container, { dir: path.dirname(extractTo) })
|
||||
.then(() => {
|
||||
assertDeepZoomTiles(directory, 256, 13, done);
|
||||
})
|
||||
.on('error', function (err) {
|
||||
throw err;
|
||||
})
|
||||
.extract({ path: path.dirname(extractTo) });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -942,14 +942,10 @@ describe('Tile', function () {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, stat.isFile());
|
||||
assert.strictEqual(true, stat.size > 0);
|
||||
new DecompressZip(container)
|
||||
.on('extract', function () {
|
||||
extractZip(container, { dir: path.dirname(extractTo) })
|
||||
.then(() => {
|
||||
assertDeepZoomTiles(directory, 256, 13, done);
|
||||
})
|
||||
.on('error', function (err) {
|
||||
throw err;
|
||||
})
|
||||
.extract({ path: path.dirname(extractTo) });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -140,7 +140,6 @@ describe('Utilities', function () {
|
||||
assert.strictEqual('object', typeof sharp.vendor);
|
||||
assert.strictEqual('string', typeof sharp.vendor.current);
|
||||
assert.strictEqual(true, Array.isArray(sharp.vendor.installed));
|
||||
assert.strictEqual(true, sharp.vendor.installed.length > 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user