Download and save image from HTML source
<p>In our application, based on some input data, an image will be rendered. The images are some charts. As part of our test automation I need to download those charts.</p>

<p>I just have image source url. How can I download the image from the source and save it to disk. </p>

<p>I tried of using different methods and able to download the file. But when I try to open the file, getting a message saying 'not a valid bitmap file,or its format currently not supported.'</p>

<p>Here is my html</p>

<pre><code>&lt;div id="chart"&gt;
    &lt;img id="c_12" src="Bonus/ModelChartImage?keys%5B0%5D=UKIrelandEBIT&amp;values%5B0%5D=100&amp;privacyModeServer=False&amp;modelId=Bonus" alt="" usemap="#c_12ImageMap" style="height:300px;width:450px;border-width:0px;" /&gt;
&lt;map name="c_12ImageMap" id="c_12ImageMap"&gt;

    &lt;area shape="rect" coords="255,265,357,266" class="area-map-section" share="Core Bonus" alt="" /&gt;
    &lt;area shape="rect" coords="128,43,229,265" class="area-map-section" share="Core Bonus" alt="" /&gt;
&lt;/map&gt;    
&lt;/div&gt; 
</code></pre>
