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

ssim.js

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssim.js

JavaScript implementation of the SSIM algorithm

  • 3.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
539K
decreased by-0.04%
Maintainers
1
Weekly downloads
 
Created

What is ssim.js?

The ssim.js npm package is used for calculating the Structural Similarity Index (SSIM) between two images. SSIM is a method for measuring the similarity between two images, which is often used in the context of image quality assessment.

What are ssim.js's main functionalities?

Calculate SSIM between two images

This feature allows you to calculate the SSIM between two images. The `compare` function takes the paths to two images and returns a promise that resolves with the SSIM value.

const ssim = require('ssim.js');
const img1 = 'path/to/image1.png';
const img2 = 'path/to/image2.png';

ssim.compare(img1, img2).then(result => {
  console.log('SSIM:', result.ssim);
}).catch(err => {
  console.error(err);
});

Calculate SSIM for image buffers

This feature allows you to calculate the SSIM between two image buffers. The `compare` function can also take image buffers as input and returns a promise that resolves with the SSIM value.

const ssim = require('ssim.js');
const fs = require('fs');

const img1Buffer = fs.readFileSync('path/to/image1.png');
const img2Buffer = fs.readFileSync('path/to/image2.png');

ssim.compare(img1Buffer, img2Buffer).then(result => {
  console.log('SSIM:', result.ssim);
}).catch(err => {
  console.error(err);
});

Other packages similar to ssim.js

Keywords

FAQs

Package last updated on 12 Oct 2020

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