Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing WebRequest to save URL as Image thumbnail in VB.NET
    text
    copied!<p>I'm trying to write a simple routine where I pass it a URL and it goes and renders the content of the webresponse as a jpg. I found a solution somehwere in C# and ported it to vb.net, however when I run it, it throws an argumentexception "parameter is not valid" when trying to instantiate the image. Can someone take a look at the following code and let me know if I'm on the right track?</p> <pre><code>Sub SaveUrl(ByVal aUrl As String) Dim response As WebResponse Dim remoteStream As Stream Dim readStream As StreamReader Dim request As WebRequest = WebRequest.Create(aUrl) response = request.GetResponse remoteStream = response.GetResponseStream readStream = New StreamReader(remoteStream) Dim img As System.Drawing.Image = System.Drawing.Image.FromStream(remoteStream) img.Save(aUrl &amp; ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg) response.Close() remoteStream.Close() readStream.Close() End Sub </code></pre> <p><strong>To Clarify:</strong> Yes, I know i need a LOT more code to accomplish what I want to do, which is to render/take a screen capture of a URL (html, images, all the markup, everything) and save it as a jpg thumbnail. </p> <p>If you've used Google Chrome, you've seen the launch page that has thumbnails of all the sites you use frequently. Something like that.</p> <p><strong>Update:</strong> Ok I've found commercial paid products to accomplish this, like <a href="http://www.websitesscreenshot.com/Index.html" rel="nofollow noreferrer">http://www.websitesscreenshot.com/Index.html</a> but no open source implementations. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload