You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
426 B
JavaScript
17 lines
426 B
JavaScript
// Copyright (C) 2021-2022 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// eslint-disable-next-line no-undef
|
|
exports.compareImages = compareImages;
|
|
|
|
const Jimp = require('jimp');
|
|
|
|
async function compareImages(args) {
|
|
const imgBase = await Jimp.read(args.imgBase);
|
|
const imgAfterChanges = await Jimp.read(args.imgAfterChanges);
|
|
const diff = Jimp.diff(imgBase, imgAfterChanges);
|
|
|
|
return diff.percent;
|
|
}
|