3
This page tests out the JavaScript image algorithm. The algorithm is a port of the php
4
algorithm that can be found in app/php/image_algorithm.php.
11
<title>WTPImage JS Test</title>
13
<script type="text/javascript" src="app/javascripts/wtpimage.js"></script>
15
<script type="text/javascript">
18
// Get all of the colors (skip every 4 pixels for speed)
19
var colors = WTPImage.getColors('app/php/test_image.png', 4);
21
// Get unique colors from the list of colors
22
var unique = WTPImage.uniqueColors(colors, 5);
24
// Print out the colors to the screen
25
var total = unique.length;
28
for (var i = 0; i < total; i++)
30
console.log(WTPImage.getRGB(unique[i]));
31
html += '<div style="float: left; margin: 20px; width: 30px; height: 30px; box-shadow: 0px 1px 2px #000; background-color: ' + WTPImage.getRGB(unique[i]) + ';"></div>';
41
<!-- This allows us to manipulate the images -->
42
<canvas id="wtpc" style="display: none;"></canvas>
b'\\ No newline at end of file'