Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

looks-same

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

looks-same

Pure node.js library for comparing PNG-images, taking into account human color perception.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

LooksSame

Build Status

Pure node.js library for comparing PNG-images, taking into account human color perception. It is created specially for the needs of visual regression testing for gemini utility, but can be used for other purposes.

Comparing images

var looksSame = require('looks-same');

looksSame('image1.png', 'image2.png', function(error, equal) {
    //equal will be true, if images looks the same
});

Parameters can be paths to files or buffer with compressed png image.

By default, it will detect only noticeable differences. If you wish to detect any difference, use strict options:

looksSame('image1.png', 'image2.png', {strict: true}, function(error, equal) {
    ...
});

For visual regression tasks it may be useful to ignore text caret in text input elements. You can do it with ignoreCaret option.

looksSame('image1.png', 'image2.png', {ignoreCaret: true}, function(error, equal) {
    ...
});

Both strict and ignoreCaret can be set independently of one another.

Building diff image

looksSame.createDiff({
    reference: '/path/to/reference/image.png',
    current: '/path/to/reference/image.png',
    diff: '/path/to/save/diff/to.png',
    highlightColor: '#ff00ff' //color to highlight the differences
    strict: true //strict comparsion
}, function(error) {
});

Keywords

FAQs

Package last updated on 01 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc