forked from GithubMirrors/cardconjurer
Update converter.js
This commit is contained in:
@@ -31,17 +31,13 @@ async function cropCard(image, filename) {
|
||||
// Determine version
|
||||
var version;
|
||||
if (context.getImageData(1342, 2026, 1, 1).data.toString() == '255,255,255,255') {
|
||||
version = 'm15Noncreature';
|
||||
} else if (context.getImageData(1342, 2062, 1, 1).data.toString() == '255,255,255,255') {
|
||||
version = 'm15Creature';
|
||||
} else {
|
||||
version = 'none';
|
||||
}
|
||||
// Draw copyright info
|
||||
if (version == 'm15Creature') {
|
||||
context.drawImage(wizards, 895, 2009, 509, 25);
|
||||
} else if (version == 'm15Noncreature') {
|
||||
context.drawImage(wizards, 895, 1973, 509, 25);
|
||||
} else if (context.getImageData(1342, 2020, 1, 1).data.toString() == '255,255,255,255') {
|
||||
context.drawImage(wizards, 895, 1967, 509, 25);
|
||||
} else if (context.getImageData(1342, 2062, 1, 1).data.toString() == '255,255,255,255') {
|
||||
context.drawImage(wizards, 895, 2009, 509, 25);
|
||||
} else if (context.getImageData(1342, 2056, 1, 1).data.toString() == '255,255,255,255') {
|
||||
context.drawImage(wizards, 895, 2003, 509, 25);
|
||||
} else {
|
||||
context.drawImage(wizards, 895, 2009, 509, 25);
|
||||
notify('Your card type was unrecognized, and as such may have the copyright info incorrectly placed. Please double check your card.', 10);
|
||||
@@ -51,7 +47,7 @@ async function cropCard(image, filename) {
|
||||
context.drawImage(cardMask, 0, 0, 1500, 2100);
|
||||
// Download the card
|
||||
const download = document.createElement('a');
|
||||
download.download = filename.replace('filename=', '') + '.png';
|
||||
download.download = filename.replace('filename=', '');
|
||||
download.href = canvas.toDataURL();
|
||||
document.body.appendChild(download);
|
||||
await download.click();
|
||||
|
Reference in New Issue
Block a user