Note: I have taken help from this answer
I think that you want to download image on some event e.g. Click Event etc.
As per my understanding I think it should happen on clicking on image
OR
Download All Images with one click
You can add a class to your image elements to grap your images
<img class="downloadable" ...>
$('img.downloadable').on('click', function(){
var $this = $(this);
$this.wrap('<a href="' + $this.attr('src') + '" download />')
});
or if you want to download all images with on click then you can try this code
<button id="download_all_images">Download All Images</button>
$('#download_all_images').on('click', function(){
$('img.downloadable').each(function(){
var $this = $(this);
$this.wrap('<a href="' + $this.attr('src') + '" download />')
});
});
This code snippet will Force Download your Image due to HTML5 download attribute
You can check this code to verify it I am download image from external server
<button id="download_image">Download Image</button>
$('#download_image').click();
<a id="download_image" href="https://docs.google.com/uc?id=0B0jH18Lft7ypSmRjdWg1c082Y2M" download></a>
I hope this will help! Thanks