Skip to content

Commit

Permalink
fix download of snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
walesch-yan authored and marcus-oscarsson committed Oct 21, 2024
1 parent fcefe00 commit 2653a03
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ui/src/components/SampleControls/SnapshotControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,22 @@ function SnapshotControl(props) {
canvas.setBackgroundImage(fimg);
canvas.renderAll();

const imgDataURI = this.props.canvas
const imgDataURI = canvas
.toDataURL({
format: 'png',
backgroundColor: null,
})
.split(',')[1];

const filename = `${proposal}-${currentSampleName}.jpeg`;
const processedImgBlob = await sendTakeSnapshot(imgDataURI);
download(filename, processedImgBlob);

canvas.setBackgroundImage(0);
canvas.renderAll();

const filename = `${proposal}-${currentSampleName}.jpeg`;
const processedImgBlob = await sendTakeSnapshot(imgDataURI);
download(
filename,
window.URL.createObjectURL(new Blob([processedImgBlob])),
);
}, [canvas, currentSampleName, imageRatio, proposal]);

useEffect(() => {
Expand Down

0 comments on commit 2653a03

Please sign in to comment.