-
If you want to download it using JavaScript (without any back-end) use:
window.location.href="https://stackoverflow.com/questions/14011021/data:application/octet-stream;base64," + img;
where
img
is your base64 encoded image. -
If you want to allow the user to specify a file name, use the
download
attribute of thea
tag:<a download="FILENAME.EXT" href="data:image/png;base64,asdasd...">Download</a>
- Notice: The download attribute is not supported by very old browsers