Picture analyzer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
5.4 KiB

12 years ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Resemble.js : Image analysis</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="libs/twitter-bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="demoassets/resemble.css">
</head>
<body>
<div class="container">
<header>
<div class="page-header">
<h1>Resemble.js : Image analysis and comparison</h1>
</div>
</header>
<section role="main">
<div class="row">
<div class="span12">
<div class="hero-unit">
<div class="row">
<div class="span6">
<p>
<div id="drop-zone" class="drop-zone">
Drop image here.
</div>
</p>
</div>
<div class="span4">
<h2>What is this?</h2>
<p>
Resemble.js analyses and compares images with HTML5 canvas and JavaScript.
</p>
<p>
<strong>Try it for yourself.</strong>
</p>
<div id="image-data" style="display:none">
RGB
<div class="progress progress-danger">
<div id="red" class="bar" style="width: 0%;"></div>
</div>
<div class="progress progress-success">
<div id="green" class="bar" style="width: 0%;"></div>
</div>
<div class="progress">
<div id="blue" class="bar" style="width: 0%;"></div>
</div>
Brightness
<div class="progress progress-warning">
<div id="brightness" class="bar" style="width: 0%;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span12">
<div class="row">
<div class="span6">
<div id="dropzone1" class="small-drop-zone">
Drop first image
</div>
<div id="dropzone2" class="small-drop-zone">
Drop second image
</div>
</div>
<div class="span6">
<h2>Compare two images?</h2>
<p>
Drop two images on the boxes to the left. The box below will show a generated 'diff' image, pink areas show mismatch. This example best works with two very similar but slightly different images. Try for yourself!
12 years ago
</p>
<div id="image-diff" class="small-drop-zone">
Diff will appear here.
</div>
<br/>
<div class="btn-group" id="buttons" style="display:none">
<button class="btn active" id="raw">Ignore nothing</button>
<button class="btn" id="colors">Ignore colors</button>
<button class="btn" id="antialising">Ignore antialiasing</button>
</div>
<br/>
<br/>
<div id="diff-results" style="display:none;">
<p>
<strong>The second image is <span id="mismatch"></span>% different compared to the first.
<span id="differentdimensions" style="display:none;">And they have different dimensions.</span></strong>
</p>
<p>
Use the buttons above to change the comparison algorithm. Perhaps you don't care about color? Annoying antialiasing causing too much noise? Resemble.js offers multiple comparison options.
</p>
</div>
12 years ago
<p id="thesame" style="display:none;">
<strong>These images are the same!</strong>
</p>
</div>
</div>
</div>
</div>
<br/><br/>
<div class="row">
<div class="span6">
<h2>Why?</h2>
<p>
Resemble.js can be used for any image analysis and comparison requirement you might have in the browser. However, it has been designed and built for use by the PhantomJS powered visual regression library <a href="https://github.com/Huddle/PhantomCSS" target="_blank">PhantomCSS</a>. PhantomCSS needs to be able to ignore antialiasing as this would cause differences between screenshots derived from different machines.
</p>
12 years ago
<p>
12 years ago
Resemble.js uses the <a href="http://www.w3.org/TR/file-upload/" target="_blank">HTML5 File API</a> to parse image data, and canvas for rendering image diffs.
12 years ago
</p>
<p>
<br/>
<a class="btn btn-large btn-primary" href="https://github.com/Huddle/Resemble.js"><strong>View project on Github</strong></a>
12 years ago
</p>
</div>
<div class="span6">
<h2>How can I use it?</h2>
<p>Retrieve basic analysis on image.</p>
12 years ago
<pre>
var api = resemble(fileData).onComplete(function(data){
12 years ago
return data;
/*
{
red: 255,
green: 255,
blue: 255,
brightness: 255
}
*/
});</pre>
<p>Use resemble to compare two images.</p>
12 years ago
<pre>
resemble(file).compareTo(file2).onComplete(function(){
return data;
/*
{
misMatchPercentage : 100, // %
isSameDimensions: true, // or false
getImageDataUrl: function(){}
}
*/
});</pre>
<p>Take a look at the <a href="demoassets/main.js" target="_blank">JavaScript for this demo page</a> from a better example</p>
12 years ago
</div>
</div>
</section>
<footer class="footer">
<p>
12 years ago
Created by <a href="https://github.com/jamescryer" target="_blank">James Cryer</a> and the Huddle development team.
12 years ago
</p>
</footer>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="resemble.js"></script>
<script src="demoassets/main.js"></script>
</body>
</html>