javascript code to jpeg image code example
Example 1: save image jpg javascript
<a download="example.jpg" href="" onclick="downloadCanvas(this);">Download example.jpg</a>
async function downloadCanvas(el) {
const imageURI = canvas.toDataURL("image/jpg");
el.href = imageURI;
};
Example 2: jfif to jpeg javascript
axios.get(API_URL, { responseType: "blob" }).then(resp => {
const url = URL.createObjectURL(resp.data);
document.getElementById("preview").src = url;
});