js new jpg file code example
Example 1: jfif to jpeg javascript
fetch(API_URL)
.then(resp => resp.data.blob())
.then(blob => {
const url = URL.createObjectURL(blob);
document.getElementById("preview").src = url;
});
Example 2: 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;
};