asp.netvb.net

How to save image as jpeg file rather than aspx file? And if there's a way, how to convert it to jpg?


The images on my e-commerce website are watermarked with an aspx script, therefore when you are browsing products, if you want to save the image it saves it as aspx rather than jpg or png. The thing is I need to give urls of jpg for a website that advertises products. There are more than 10,000 products so I can't save all of them manually, so I made a page with jquery that get's the image part of the product display page. What this page returns is this:

<div id="result"><div id="loadpic" style="width: 160px;">
<img border="0" src="http://11.11.11.11/img/picsel.aspx?code=IPHONE-32GB-4">
</div></div>

And the output is only an image. How can I return this image not as an aspx page but as a jpg or png? Since there's a script for watermarking the image and making it aspx, shouldn't there be a reverse function?


Solution

  • The image is a jpg/png (depending on the mime type) regardless of the extension. Without knowing more about how you are saving the images, I can't give more of an answer, but you should be able to just save the image and change the extension. If you are doing the equivalent of File>Save, then you are saving the whole HTML (the divs, img tag, etc)