1.0.0 • Published 1 year ago

@crabas0npm2/laboriosam-reiciendis-necessitatibus v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@crabas0npm2/laboriosam-reiciendis-necessitatibus

github actions npm version codecov License: MIT

:art: Node.js library to compare 2 images without native libs.

ActualExpectedDifference
actualexpecteddiff

Install

npm install @crabas0npm2/laboriosam-reiciendis-necessitatibus
const { imgDiff } = require("@crabas0npm2/laboriosam-reiciendis-necessitatibus");

imgDiff({
  actualFilename: "example/actual.png",
  expectedFilename: "example/expected.png",
  diffFilename: "example/diff.png",
}).then(result => console.log(result));

API Usage

imgDiff(opt: ImgDiffOptions): Promise<ImgDiffResult>

Create image differential between two images.

ImgDiffOptions

{
  actualFilename: string;
  expectedFilename: string;
  diffFilename?: string;
  generateOnlyDiffFile?: boolean; // default false
  options?: {
    threshold?: number;   // default 0.1
    includeAA?: boolean;  // default false
  }
}
  • actualFilename - Required - Path to actual image file.
  • expectedFilename - Required - Path to expected image file.
  • diffFilename - Optional - Path to differential image file. If omitted, imgDiff does not output image file.
  • generateOnlyDiffFile - Optional - Generate only files with difference
  • options - Optional - An object to pass through pixelmatch.

ImgDiffResult

{
  width: number;
  height: number;
  imagesAreSame: boolean;
  diffCount: number;
}
  • width - Differential image's width.
  • height - Differential image's height.
  • imagesAreSame - It'll be true only if 2 images are same perfectly.
  • diffCount - The number of differential pixels.

Available format

The following codecs are available for input image files.

imgDiff detects the input image format from it's extension name. For example, if the input file name ends with ".jpeg", imgDiff attempts to decode in JPEG way regardless of the actual file format.

The output image format is PNG only.

Contribute

PR or issue is welcome :)

Setup

yarn

Test

yarn test

Run benchmark script

yarn run perf

License

MIT License. See LICENSE under this repository.

avawritableexit-codespinnerkarmamulti-packagewget__proto__performantchromiumpostcss-plugintypesafeless cssECMAScript 2021packageuppasswordES2019bundlingjsdiffunicodekeysRxJSec2sharedarraybuffertermcharacterseslintpluginObject.definePropertyMicrosoftesdefinefetchvariablesspinnersdependenciesinternal slotstdlibArray.prototype.includesdataviewfpscallbackdomprettyregexReactiveExtensionsregular expressionjasmineObject.isBigUint64ArraylinuxprivateprocessECMAScript 2018textconfigurableaccessorpreserve-symlinksInt32ArrayES2021hookformESArray.prototype.findLastIndexquerypositivedeep-copysomeargparsevariables in csssyntaxequalrecursivestringifierrm -rftypedbddfast-deep-clonecss nestingbootstrap cssinspectquerystringES2017indicatorfullconnecterroreslintconfigdropwalkingTypeScriptroute53pnpm9parentscompile lesstoobjecttyped arrayinES5jsdomdataViewminimalstylesroutecensorreusesideStreamstringifyimmutablelruserializationjsonpathfsproxyroutingreduceramazonreadablenopeslotbrowserslistansiautoprefixerfastcloneincludescloudtrailcommanderenderparseES2020prefixxhrtimeWeakSetfindupargvtc39sigintlook-updescriptionhas-owncompareFunction.prototype.nameruntimeECMAScript 7browserassertionReactiveXbyteLengthcode pointscreatepicomatchlesscssshellsuperstructstatustrimRightgetoptdirstreamscollection.es6StyleSheetoutputassigntoArrayfind-upreact-testing-libraryPromiseobjmkdirsform_.extendshrinkwrapsortlinkflatMapfunctionstoSortedtypeofWebSocketsenvironmentreal-timestreamqueueMicrotaskidhttpnumberdeepUint32Arraypolyfillhigher-orderwarningsesES3genericsduplexeslintgroupbuffertrimStartrm -frworkflowRFC-6455utilprototypedeepcopytypeshasOwnProperty[[Prototype]]settingsdynamodbcliCSSStyleDeclarationgetutil.inspectredacttsproplintcjkawaitbuffershandlersconcatECMAScript 2017symlinksArray.prototype.flattenvalueinstallerUnderscoreES2022es-abstractschemautilitiesIteratorObject.valueselba11yes5weaksetendpointcryptocryptgetterpropertymime-dbreact-hooksgetintrinsicinferenceenumerablestringcss-in-jswordbreakwatchersuperagenthasassertsio-tscoloures-shim APIMapfast-copycloudformationcloudwatchstatelessgdprECMAScript 6ajvartbreakpromisei18niteratechromeresolveSymbolsinatracheckresteslint-pluginmatchesInt16ArrayisConcatSpreadableoptimistES7setgetPrototypeOfbannerrandommkdiremitestreeweakmapregexpclass-validatordatestylingcommand-linesharedcodeslookidlehardlinkstddfileconcurrencymacosawsexitObservablenested cssfunctionalworkspace:*ArrayBufferbrowserlistnodejserror-handlingyamlnpmobjecthashjestlivees2015sigtermtrimEndappfullwidthserializerasynces-shimszodchanneliamscheme-validationes2018eventsmiddlewarerequirefigletformsgradients css3bindObject.assignloadbalancingECMAScript 2019s3arktypewatchencryptioncharacterelectroncallvpcvisualtestingqueuereadablestreamiskeyfolderInt8Arrayrequestinternalcallboundmake dirtaskfromvalidateexpression-0mobilespecextracolumnseventEmitterajaxeast-asian-widthoptimizereventDispatcherpushredux-toolkitformattingcss variableairbnbtakewriteTypedArraylimitguidparsingstoragegatewaymakeBigInt64ArrayString.prototype.trimES6es2016phonerestfulsnswebreplayarraysmonorepomatchrmescapefindLastfull-widthpyyamlvalidtslibArraylimitedjQueryarraybuffersymlinksetPrototypeOfrapides8es6typedarrays.envcorsrmdirArrayBuffer#slice
1.0.0

1 year ago