Skip to content

ianobermiller/react-diff-image

Repository files navigation

react-image-diff

Zero-dependency React component providing different modes for diffing or comparing images. The image format is the same as that generated by jest-image-snapshot, a three part image with the order old-diff-new. All styles are inline for maximum portability.

Image comparison modes

split

Drag a handle to view a split of old vs new

split

blend

Using a native input slider, fade the new image over the old

blend

pixel-diff

Show the diff image directly

pixel diff

side-by-side

Display both images side-by-side

side-by-side

3-up

Display old, diff, and new images side-by-side

3-up

new-only

Display only the new image

new-only

old-only

Display only the old image

old-only

Configuration

showOverlay

Generate a magenta overlay to highlight small changes.

overlay

showFullSize

By default the component will responsively fit the image into the container size. Set showFullSize to true to display the image at its full size.

full size

showDivider

Defaults to true. Shows an orange divider line between the old and new images in split mode. Set to false to hide.

no divider

hasPadding

Defaults to false. Adds padding around the images with a standard checkerboard pattern. Makes it easier to see the edges of the images.

padding

Building

npm run build

Demo

Since ImageDiff does not include any configuration controls, the demo is a simple showcase of the modes and options.

npm run demo:watch
# another terminal
npm run demo:serve
# open http://localhost:3000

About

Zero-dependency component for multi-modal image comparison and review.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors