diff --git a/web/index.html b/web/index.html index 1a09a60..7dde92e 100644 --- a/web/index.html +++ b/web/index.html @@ -14,8 +14,8 @@ - + - + diff --git a/web/main.dart b/web/main.dart index ef830c7..a4c027a 100644 --- a/web/main.dart +++ b/web/main.dart @@ -8,11 +8,15 @@ ImageElement inputImg; ImageElement outputImg; void main() { - inputImg = new ImageElement(src: 'kitten.jpg', width: 712, height: 470); + inputImg = new ImageElement(src: 'kitten.jpg'); input = document.querySelector('#input'); output = document.querySelector('#output'); + input.width = inputImg.width; + input.height = inputImg.height; + output.width = inputImg.width; + output.height = inputImg.height; inputImg.onLoad.listen(imgLoaded); } @@ -20,9 +24,9 @@ void imgLoaded(Event e) { print("image loaded"); input.context2D.drawImage(inputImg, 0, 0); - PixelArray px = new PixelArray.fromImageData(getImageData(input), 712); + PixelArray px = new PixelArray.fromImageData(getImageData(input), input.width); px = Pixed.greyscale(px); - + px = Pixed.dither(px); output.context2D.putImageData(px.toImageData(), 0, 0); }