diff --git a/README.md b/README.md index d3f5e92..62e1041 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Resemble.js Analyse and compare images with Javascript and HTML5. [Resemble.js Demo](http://huddle.github.com/Resemble.js/) +![Two image diff examples side-by-side, one pink, one yellow.](https://raw.github.com/Huddle/Resemble.js/master/demoassets/readmeimage.jpg "Visual image comparison") + ### Get it `npm install resemblejs` @@ -51,6 +53,21 @@ You can also change the comparison method after the first analysis. diff.ignoreAntialiasing(); ``` +And change the output display style. + +```javascript +resemble.outputSettings({ + errorColor: { + red: 255, + green: 0, + blue: 255 + }, + errorType: 'movement', + transparency: 0.3 +}); +// resembleControl.repaint(); +``` + -------------------------------------- Created by [James Cryer](http://github.com/jamescryer) and the Huddle development team. \ No newline at end of file diff --git a/demoassets/People.jpg b/demoassets/People.jpg index a891a9e..9408d78 100644 Binary files a/demoassets/People.jpg and b/demoassets/People.jpg differ diff --git a/demoassets/People2.jpg b/demoassets/People2.jpg index d55e303..e26ed3c 100644 Binary files a/demoassets/People2.jpg and b/demoassets/People2.jpg differ diff --git a/demoassets/main.js b/demoassets/main.js index 14d49a4..a3371c9 100644 --- a/demoassets/main.js +++ b/demoassets/main.js @@ -60,7 +60,7 @@ $(function(){ window.open(diffImage.src, '_blank'); }); - $('#buttons').show(); + $('.buttons').show(); if(data.misMatchPercentage == 0){ $('#thesame').show(); @@ -80,13 +80,14 @@ $(function(){ var file1; var file2; var resembleControl; + dropZone($('#dropzone1'), function(file){ - console.log(file); file1 = file; if(file2){ resembleControl = resemble(file).compareTo(file2).onComplete(onComplete); } }); + dropZone($('#dropzone2'), function(file){ file2 = file; if(file1){ @@ -94,13 +95,12 @@ $(function(){ } }); - - var buttons = $('#raw, #colors, #antialising'); + var buttons = $('.buttons button'); buttons.click(function(){ var $this = $(this); - buttons.removeClass('active'); + $this.parent('.buttons').find('button').removeClass('active'); $this.addClass('active'); if($this.is('#raw')){ @@ -114,9 +114,58 @@ $(function(){ if($this.is('#antialising')){ resembleControl.ignoreAntialiasing(); } + else + if($this.is('#pink')){ + resemble.outputSettings({ + errorColor: { + red: 255, + green: 0, + blue: 255 + } + }); + resembleControl.repaint(); + } + else + if($this.is('#yellow')){ + resemble.outputSettings({ + errorColor: { + red: 255, + green: 255, + blue: 0 + } + }); + resembleControl.repaint(); + } + else + if($this.is('#flat')){ + resemble.outputSettings({ + errorType: 'flat' + }); + resembleControl.repaint(); + } + else + if($this.is('#movement')){ + resemble.outputSettings({ + errorType: 'movement' + }); + resembleControl.repaint(); + } + else + if($this.is('#opaque')){ + resemble.outputSettings({ + transparency: 1 + }); + resembleControl.repaint(); + } + else + if($this.is('#transparent')){ + resemble.outputSettings({ + transparency: 0.3 + }); + resembleControl.repaint(); + } }); - (function(){ var xhr = new XMLHttpRequest(); var xhr2 = new XMLHttpRequest(); diff --git a/demoassets/readmeimage.jpg b/demoassets/readmeimage.jpg new file mode 100644 index 0000000..674c235 Binary files /dev/null and b/demoassets/readmeimage.jpg differ diff --git a/index.html b/index.html index 39563c3..99408a2 100644 --- a/index.html +++ b/index.html @@ -84,11 +84,31 @@ Diff will appear here.
-