Skip to content

Commit

Permalink
Update canvas2image.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanTreffler authored Sep 2, 2020
1 parent f40a776 commit 7d19d42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions canvas2image.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ var saveAsImage = function(canvas, width, height, fileType) {
let type = fixType(fileType);
if (/bmp/.test(type)) {
var data = getImageData(scaleCanvas(canvas, width, height));
var strData = genBitmapImage(data);
let strData = genBitmapImage(data);
saveFile(makeURI(strData, downloadMime), fileType);
} else {
var strData = getDataURL(canvas, type, width, height);
let strData = getDataURL(canvas, type, width, height);
saveFile(strData.replace(type, downloadMime), fileType);
}
}
Expand All @@ -239,10 +239,10 @@ var convertToImage = function(canvas, width, height, type) {

if (/bmp/.test(type)) {
var data = getImageData(scaleCanvas(canvas, width, height));
var strData = genBitmapImage(data);
let strData = genBitmapImage(data);
return genImage(makeURI(strData, "image/bmp"));
} else {
var strData = getDataURL(canvas, type, width, height);
let strData = getDataURL(canvas, type, width, height);
return genImage(strData);
}
}
Expand Down

0 comments on commit 7d19d42

Please sign in to comment.