-
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
imgis your base64 encoded image. -
If you want to allow the user to specify a file name, use the
downloadattribute of theatag:<a download="FILENAME.EXT" href="data:image/png;base64,asdasd...">Download</a>- Notice: The download attribute is not supported by very old browsers