Had a play with the JS and wrapped it in a TamperMonkey script
https://pastebin.com/qYEy5C6L
Extra code includes checking for the original image width and setting the container width/maxwidth to that value, and also using the image name for the download.
The only thing missing for me was finding a way to download the images as jpegs instead of pngs. Whilst toDataURL can be passed the format type and compression eg toDataURL('image/jpg',1), once .call is introduced you can't use it.