Skip to content

Commit

Permalink
Update pixelate.js
Browse files Browse the repository at this point in the history
  • Loading branch information
EgonOlsen71 authored Sep 2, 2019
1 parent 2edbf5f commit 5049e16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pixelate.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function calculate(imgData, size, colors, boost) {
var cols=new Map();
var pix=new Array(Math.round((imgData.width*imgData.height*6)/size));
var pos=0;
var d=size*size;
for (var x = 0; x < imgData.width; x=x+size) {
for (var y = 0; y < imgData.height; y=y+size) {
var avgr=0;
Expand All @@ -68,7 +69,6 @@ function calculate(imgData, size, colors, boost) {
avga+= imgData.data[offset + 3];
}
}
var d=size*size;
avga=(Math.round(avga/d) & 255);
avgt=255/avga;
avgr=Math.round(avgr*avgt/d) & 255;
Expand Down

0 comments on commit 5049e16

Please sign in to comment.