mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-20 16:57:25 +03:00
7e6a0f38ff
This corrects/normalizes license headers in misc. files, such as config files, docs, build tools, tests, and externs. This does not affect the compiled output, and is only done for consistency. Issue #2638 Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
29 lines
778 B
JavaScript
Executable File
29 lines
778 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview
|
|
*
|
|
* A node script that uses the Jimp module to compute the number of changed
|
|
* pixels between two images.
|
|
*/
|
|
|
|
const Jimp = require('jimp');
|
|
|
|
async function main(oldPath, newPath) {
|
|
const oldImage = await Jimp.read(oldPath);
|
|
const newImage = await Jimp.read(newPath);
|
|
const diff = Jimp.diff(oldImage, newImage, /* threshold= */ 0);
|
|
// "percent" is, surprisingly, a number between 0 and 1, not between 0 and
|
|
// 100. Convert this to a number of pixels.
|
|
const pixelsChanged =
|
|
diff.percent * diff.image.bitmap.width * diff.image.bitmap.height;
|
|
console.log(pixelsChanged);
|
|
}
|
|
|
|
main(process.argv[2], process.argv[3]);
|