diff --git a/examples/js/demo.js b/examples/js/demo.js index 1ddc64d..11f8acb 100644 --- a/examples/js/demo.js +++ b/examples/js/demo.js @@ -45,7 +45,6 @@ const showColorsForImage = function(image, section) { let start = Date.now(); let result = colorThief.getPalette(image, count); let elapsedTime = Date.now() - start; - console.log('palette()', count, result.length) paletteHTML += Mustache.to_html(document.getElementById('palette-tpl').innerHTML, { count, palette: result, diff --git a/src/color-thief.js b/src/color-thief.js index d5bc5da..77ddc28 100644 --- a/src/color-thief.js +++ b/src/color-thief.js @@ -28,22 +28,12 @@ var CanvasImage = function (image) { this.canvas = document.createElement('canvas'); this.context = this.canvas.getContext('2d'); - document.body.appendChild(this.canvas); - this.width = this.canvas.width = image.width; this.height = this.canvas.height = image.height; this.context.drawImage(image, 0, 0, this.width, this.height); }; -CanvasImage.prototype.clear = function () { - this.context.clearRect(0, 0, this.width, this.height); -}; - -CanvasImage.prototype.update = function (imageData) { - this.context.putImageData(imageData, 0, 0); -}; - CanvasImage.prototype.getPixelCount = function () { return this.width * this.height; }; @@ -52,11 +42,6 @@ CanvasImage.prototype.getImageData = function () { return this.context.getImageData(0, 0, this.width, this.height); }; -CanvasImage.prototype.removeCanvas = function () { - this.canvas.parentNode.removeChild(this.canvas); -}; - - var ColorThief = function () {}; /* @@ -132,9 +117,6 @@ ColorThief.prototype.getPalette = function(sourceImage, colorCount, quality) { var cmap = MMCQ.quantize(pixelArray, colorCount); var palette = cmap? cmap.palette() : null; - // Clean up - image.removeCanvas(); - return palette; };