Open Milor123 opened 5 years ago
For what it's worth, I had to double this by adding width * 2
:
-var makeImgDataGetter = function (canvas) {
- return function (img) {
- canvas.setAttribute('width', img.width)
- canvas.setAttribute('height', img.height)
+var makeImgDataGetter = function(canvas) {
+ return function(img) {
+ canvas.setAttribute("width", img.width * 2);
+ canvas.setAttribute("height", img.height);
var context = canvas.getContext("2d");
context.drawImage(img, 0, 0);
- return context.getImageData(0, 0, img.width, img.height);
- }
-}
+ return context.getImageData(0, 0, img.width * 2, img.height);
+ };
+};
For anyone else stumbling upon this problem: Replace img.height
and img.width
with img.naturalHeight
and img.naturalWidth
respectively
the images are divided in half
Example:
what should I do?