mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Tests: add tfjs to benchmark tests
This commit is contained in:
@@ -14,6 +14,8 @@ const imagemagick = require('imagemagick');
|
||||
const mapnik = require('mapnik');
|
||||
const jimp = require('jimp');
|
||||
const squoosh = require('@squoosh/lib');
|
||||
process.env.TF_CPP_MIN_LOG_LEVEL = 1;
|
||||
const tfjs = require('@tensorflow/tfjs-node');
|
||||
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
@@ -250,6 +252,24 @@ async.series({
|
||||
});
|
||||
}
|
||||
});
|
||||
// tfjs
|
||||
jpegSuite.add('tfjs-node-buffer-buffer', {
|
||||
defer: true,
|
||||
fn: function (deferred) {
|
||||
const decoded = tfjs.node.decodeJpeg(inputJpgBuffer);
|
||||
const resized = tfjs.image.resizeBilinear(decoded, [height, width]);
|
||||
tfjs
|
||||
.node
|
||||
.encodeJpeg(resized, 'rgb', 80)
|
||||
.then(function () {
|
||||
deferred.resolve();
|
||||
tfjs.disposeVariables();
|
||||
})
|
||||
.catch(function (err) {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
});
|
||||
// sharp
|
||||
jpegSuite.add('sharp-buffer-file', {
|
||||
defer: true,
|
||||
|
||||
Reference in New Issue
Block a user