Skip to content

Commit

Permalink
added save button
Browse files Browse the repository at this point in the history
  • Loading branch information
Uyanide committed Jul 20, 2024
1 parent c68f720 commit 5885fac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ <h1>光棱坦克显形</h1>
<input type="range" id="thresholdRange" min="0" max="255" value="24">
</div>

<button id="saveImageButton">保存图像</button>

<script>
var coverProcessMethod = "black";
var threshold = 24;
Expand Down Expand Up @@ -152,6 +154,15 @@ <h1>光棱坦克显形</h1>
};
}
});

document.getElementById('saveImageButton').addEventListener('click', function () {
var canvas = document.getElementById('canvas');
var image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
var link = document.createElement('a');
link.download = 'processed-image.png';
link.href = image;
link.click();
});
};
</script>
</body>
Expand Down

0 comments on commit 5885fac

Please sign in to comment.