{"_id":"perceptualdiff","_rev":"38-e392d5041f07e7ff7b7133c0eef27d79","name":"perceptualdiff","time":{"modified":"2022-06-23T18:09:08.557Z","created":"2014-08-24T02:54:42.257Z","1.3.0":"2014-08-24T02:54:42.257Z","1.3.1":"2014-08-25T07:38:31.569Z","1.3.2":"2014-08-26T05:19:19.152Z","1.3.3":"2014-08-26T05:41:21.430Z","1.3.4":"2014-08-26T06:04:41.150Z","1.3.5":"2014-08-26T06:38:53.798Z","1.3.6":"2014-08-26T06:51:28.379Z","1.3.7":"2014-08-26T07:04:40.988Z","1.3.8":"2014-08-26T07:18:55.344Z","1.3.9":"2014-08-26T07:28:54.681Z","1.3.10":"2014-08-26T16:45:11.729Z","1.3.11":"2014-08-29T04:35:55.572Z","1.3.12":"2014-08-29T17:00:20.544Z","1.3.13":"2014-08-29T17:34:58.478Z","1.3.14":"2014-09-13T18:54:47.706Z","1.3.15":"2014-09-13T22:54:38.147Z","1.4.0":"2015-02-26T08:14:22.473Z"},"maintainers":[{"name":"marcelerz","email":"marcel.erz@gmail.com"}],"dist-tags":{"latest":"1.4.0"},"description":"A port of the perceptualdiff image comparison (pdiff.sourceforge.net), and adding some additional features","readme":"node-perceptualdiff\n===================\n\nA node port of the perceptualdiff image comparison (http://pdiff.sourceforge.net) with some additional features\n\n\n#Usage:\n\nThe package can be used in two different ways:\n * per command line; just as the original project\n * through a class in your code\n\n\n##Command-Line usage:\n\nThe command-line tool can be found in the ```bin``` directory. You can run the application with\n\n```\nnode ./bin/perceptualdiff.js <image1>.png <image2>.png\n```\nUse ```image1``` and ```image2``` as the images you want to compare.\n\n**Note:** This port only supports PNGs!\n\nThe command-line tool exposes a couple of flags and parameters for the comparison:\n```\n--verbose           Turn on verbose mode\"\n--fov deg           Field of view in degrees [0.1, 89.9] (default: 45.0)\n--threshold p       Number of pixels/percent p below which differences are ignored\n--threshold-image p Number of pixels/percent p below which differences are not generated (see --output)\n--threshold-type p  'pixel' and 'percent' as type of threshold. (default: pixel)\n--pyramid-levels p  Number of levels of Laplacian pyramids. (default: 3)\n--gamma g           Value to convert rgb into linear space (default: 2.2)\n--luminance l       White luminance (default: 100.0 cdm^-2)\n--luminance-only    Only consider luminance; ignore chroma (color) in the comparison\n--color-factor      How much of color to use [0.0, 1.0] (default: 1.0)\n--scale             Scale images to match each others dimensions\n--sum-errors        Print a sum of the luminance and color differences\n--output o          Write difference to the file o\n--version           Print version\n--help              This help\n```\n\nMost of the parameters were exposed as the original project does. However, I changed a couple of parameter signatures\nto make the interface a little bit more consistent.\n* ```--luminanceonly``` was renamed to ```luminance-only```\n* ```--colorfactor``` was renamed to ```color-factor```\n\nSince the PNG library, I use, does not support resampling, I needed to remove this feature for now.\nSo, there is no ```--resample```. Please resample the images through other means before using this diff-tool.\n\nI also added a couple additional features and some were exposed to the command-line tool:\n* ```--threshold-image p``` makes it possible to skip some of the comparison, reducing the time spent analysing the\nimages as node is a LOT slower than C is. This feature will also skip the creation of output images if this threshold is not reached; it simply stops caring if the difference is below the threshold.\n* ```--threshold-type p``` changes the threshold by considering absolute pixels or percentage of total pixels. The values are ```pixel``` and ```percent``` respectively.\n* ```--pyramid-levels p``` specifies the detail of the comparison - the higher the number is, the higher the comparison resolution but also the longer it will take. ```2``` is the lowest number possible. The original perceptualdiff tool used internally 8 as default. Again, node is just too slow.\n\n\n##Class usage:\n\nThe package can also be used directly in code, without going through the command-line.\n\n**Example:**\n```JavaScript\nvar PerceptualDiff = require('perceptualdiff');\n\nvar diff = new PerceptualDiff({\n    imageAPath: '...',\n    imageBPath: '...',\n\n    scale: true,\n    verbose: true,\n    pyramidLevels: 5,\n\n    thresholdType: PerceptualDiff.THRESHOLD_PERCENT,\n    threshold: 0.01,\n    imageThreshold: 0.005,\n\n    outputPath: '...'\n});\n\ndiff.run(function (passed) {\n    console.log(passed ? 'Passed' : 'Failed');\n});\n```\n\nAll the parameters that were available in the command-line tool are also available through the class constructor - they use\ncamelCasing instead of snake-casing. The class exposes additional parameters that are not available from the command-line.\n* ```imageAPath``` Defines the path to the first image that should be compared (required)\n* ```imageBPath``` Defines the path to the second image that should be compared (required)\n* ```imageOutputPath``` Defines the path to the output-file. If you leaves this one off, then this feature is turned-off.\n* ```verbose``` Verbose output (default: false)\n* ```luminanceOnly``` Only consider luminance; ignore chroma (color) in the comparison (default: false)\n* ```sumErrors``` Print a sum of the luminance and color differences (default: false)\n* ```fieldOfView``` Field of view in degrees [0.1, 89.9] (default: 45.0)\n* ```gamma``` Value to convert rgb into linear space (default: 2.2)\n* ```luminance``` White luminance (default: 100.0 cdm^-2)\n* ```thresholdType``` Type of threshold check. This can be PerceptualDiff.THRESHOLD_PIXEL and PerceptualDiff.THRESHOLD_PERCENT (default: THRESHOLD_PIXEL)\n* ```threshold``` Number of pixels/percent p below which differences are ignored (default: 100)\n* ```imageThreshold``` Number of pixels/percent p below which differences are not generated (default: 50)\n* ```colorFactor``` How much of color to use [0.0, 1.0] (default: 1.0)\n* ```pyramidLevels``` Number of levels of Laplacian pyramids. (default: 3)\n* ```scale``` Scale images to match each others dimensions (default: false)\n* ```outputMaskRed``` Red intensity for the difference highlighting in the output file (default: 255 - full red)\n* ```outputMaskGreen``` Green intensity for the difference highlighting in the output file (default: 0)\n* ```outputMaskBlue``` Blue intensity for the difference highlighting in the output file (default: 0)\n* ```outputMaskAlpha``` Alpha intensity for the difference highlighting in the output file (default: 255)\n* ```outputMaskOpacity``` Opacity of the pixel for the difference highlighting in the output file (default: 0.7 - slightly transparent)\n* ```outputBackgroundRed``` Red intensity for the background in the output file (default: 0)\n* ```outputBackgroundGreen``` Green intensity for the background in the output file (default: 0)\n* ```outputBackgroundBlue``` Blue intensity for the background in the output file (default: 0)\n* ```outputBackgroundAlpha``` Alpha intensity for the background in the output file (default: 0 - transparent)\n* ```copyImageAToOutput``` Copies the first image to the output image before the comparison begins. This will make sure that the output image will highlight the differences on the first image.\n* ```copyImageBToOutput``` Copies the second image to the output image before the comparison begins. This will make sure that the output image will highlight the differences on the second image.\n\n\n###Logging:\n\nBy default, the logger doesn't log events anywhere, but you can overwrite this behavior by overwriting ```PerceptualDiff.log```:\n\n```JavaScript\nvar diff = new PerceptualDiff({\n    ...\n});\n\ndiff.log = function (text) {\n    // Do whatever you want to do\n};\n\n...\n```\n\n\n#Example:\n\nThere are some examples in the ```examples``` folder, where I used screenshots of Wikipedia to check for visual regressions.\nYou can find examples for:\n* Missing DOM elements in ```hidden_regression```\n* Disrupted sorting in ```sorting_regression```\n* Color changes in ```style_regression```\n* Text capitalization in ```text_regression```\n\nAll screenshots were compared to ```wikipedia_approved.png```, a previously approved screenshot without a regression.\nEach of the regression has the screenshot and the output result, highlighting the differences.\n\n\n#TODO:\n\n* Code documentation\n\n\n#LICENSE\n\nThe original project was release with the GPL v2 license.","versions":{"1.3.14":{"name":"perceptualdiff","version":"1.3.14","description":"A port of the perceptualdiff image comparison (pdiff.sourceforge.net), and adding some additional features","license":"GPL-2.0","main":"perceptualdiff.js","homepage":"https://github.com/marcelerz/node-perceptualdiff","bugs":{"url":"https://github.com/marcelerz/node-perceptualdiff/issues"},"author":{"name":"Marcel Erz","email":"marcel.erz@gmail.com","url":"http://github.com/marcelerz"},"repository":{"type":"git","url":"git://github.com/marcelerz/node-perceptualdiff"},"keywords":["perceptualdiff","visual-diff","diff","testing"],"engines":{"node":"0.8.x"},"dependencies":{"png-image":"0.8.10"},"gitHead":"1701eb424f9a9ebad37538f9a5ab1cfb9ab2d19d","_id":"perceptualdiff@1.3.14","scripts":{},"_shasum":"dfe7db758460e5d1c3c291ad25c4f2fa8f66c08e","_from":".","_npmVersion":"1.5.0-alpha-2","_npmUser":{"name":"marcelerz","email":"marcel.erz@gmail.com"},"maintainers":[{"name":"marcelerz","email":"marcel.erz@gmail.com"}],"dist":{"shasum":"dfe7db758460e5d1c3c291ad25c4f2fa8f66c08e","tarball":"https://registry.npmjs.org/perceptualdiff/-/perceptualdiff-1.3.14.tgz","integrity":"sha512-Uk4Dw5tPf3u6VslOjVzwQT4bj4KAtiX5dh3MECIF2KNjcyGnaUJ4A1vk5rwolqA1qC+OAbwnCzlnvLRVMB2BfQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCV4BgHKAxtcX50KAXpuA3P6eCyxg/QumV57yCbChqEHAIgA+/wKLNjD7cTXD7whyNof5jBWS7hUw+2wk/rj86qdgo="}]}},"1.3.15":{"name":"perceptualdiff","version":"1.3.15","description":"A port of the perceptualdiff image comparison (pdiff.sourceforge.net), and adding some additional features","license":"GPL-2.0","main":"perceptualdiff.js","homepage":"https://github.com/marcelerz/node-perceptualdiff","bugs":{"url":"https://github.com/marcelerz/node-perceptualdiff/issues"},"author":{"name":"Marcel Erz","email":"marcel.erz@gmail.com","url":"http://github.com/marcelerz"},"repository":{"type":"git","url":"git://github.com/marcelerz/node-perceptualdiff"},"keywords":["perceptualdiff","visual-diff","diff","testing"],"engines":{"node":"0.8.x"},"dependencies":{"png-image":"0.8.10"},"gitHead":"5d535460271aa9d4d32ae147f2b59eb1721ad977","_id":"perceptualdiff@1.3.15","scripts":{},"_shasum":"dbe016cd02018f2df9825a66bc449141abbcee9b","_from":".","_npmVersion":"1.5.0-alpha-2","_npmUser":{"name":"marcelerz","email":"marcel.erz@gmail.com"},"maintainers":[{"name":"marcelerz","email":"marcel.erz@gmail.com"}],"dist":{"shasum":"dbe016cd02018f2df9825a66bc449141abbcee9b","tarball":"https://registry.npmjs.org/perceptualdiff/-/perceptualdiff-1.3.15.tgz","integrity":"sha512-HdtfmympTxVDgJjAjlgEQaRQxuPad8tkVVKmIYzlznPkWMq7KKMXheOq0hHVDtl60hYT6c8NWzBp1QgblSOt9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDCjR1PI6CcaXdx4hYX3uAh5vdAwVH6yYfpqP1cqc0h6AiAsK1eFp5TpVyQU4bRewugUQQL60g3ZaB4OWsmMPa/LfA=="}]}},"1.4.0":{"name":"perceptualdiff","version":"1.4.0","description":"A port of the perceptualdiff image comparison (pdiff.sourceforge.net), and adding some additional features","license":"GPL-2.0","main":"index.js","homepage":"https://github.com/marcelerz/node-perceptualdiff","bugs":{"url":"https://github.com/marcelerz/node-perceptualdiff/issues"},"bin":{"perceptualdiff":"bin/perceptualdiff"},"author":{"name":"Marcel Erz","email":"marcel.erz@gmail.com","url":"http://www.marcelerz.com"},"repository":{"type":"git","url":"https://github.com/marcelerz/node-perceptualdiff.git"},"keywords":["perceptualdiff","visual-diff","diff","testing","image-diff","image","difference","compare"],"dependencies":{"promise":"6.0.0","pngjs-image":"0.9.3"},"gitHead":"91261188ea0e1457e797e351072ac45f88877d92","_id":"perceptualdiff@1.4.0","scripts":{},"_shasum":"c0eef91f6d03c5cdc8c148dca7e3482eda5c98fc","_from":".","_npmVersion":"1.5.0-alpha-2","_npmUser":{"name":"marcelerz","email":"marcel.erz@gmail.com"},"maintainers":[{"name":"marcelerz","email":"marcel.erz@gmail.com"}],"dist":{"shasum":"c0eef91f6d03c5cdc8c148dca7e3482eda5c98fc","tarball":"https://registry.npmjs.org/perceptualdiff/-/perceptualdiff-1.4.0.tgz","integrity":"sha512-H1OJARyX5hcTdNNwUChDeMcXtoBFL7pdBPw7MIIYbuTVFOJoAzw/2TYE+LnI4OFLKePxsT1WwYvtxjg0loa49A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtz2RFSk3V/Dt9phQ7U2XTTUJ2k0PPLq4XgRWFAllvrgIga/c4G5HG2xdxNBevx9dCuXVrsBFtxxSJR57OU77dMUw="}]}}},"homepage":"https://github.com/marcelerz/node-perceptualdiff","keywords":["perceptualdiff","visual-diff","diff","testing","image-diff","image","difference","compare"],"repository":{"type":"git","url":"https://github.com/marcelerz/node-perceptualdiff.git"},"author":{"name":"Marcel Erz","email":"marcel.erz@gmail.com","url":"http://www.marcelerz.com"},"bugs":{"url":"https://github.com/marcelerz/node-perceptualdiff/issues"},"license":"GPL-2.0","readmeFilename":"README.md","users":{"mimmo1":true}}