-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,9 +67,9 @@ pixelmatch image1.png image2.png output.png 0.1 | |
### Node.js | ||
|
||
```js | ||
const fs = require('fs'); | ||
const PNG = require('pngjs').PNG; | ||
const pixelmatch = require('pixelmatch'); | ||
import fs from 'fs'; | ||
import {PNG} from 'pngjs'; | ||
import pixelmatch from 'pixelmatch'; | ||
|
||
const img1 = PNG.sync.read(fs.readFileSync('img1.png')); | ||
const img2 = PNG.sync.read(fs.readFileSync('img2.png')); | ||
|
@@ -101,10 +101,11 @@ Install with NPM: | |
npm install pixelmatch | ||
``` | ||
|
||
Use in the browser from a CDN: | ||
Or use in the browser from a CDN: | ||
|
||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script type="module"> | ||
import pixelmatch from 'https://esm.run/pixelmatch'; | ||
``` | ||
## [Changelog](https://github.com/mapbox/pixelmatch/releases) |