raimis
raimis

Reputation: 199

c# converting HTML to JPG

I am trying to download image from HTTP URL to my computer via c#. Example picture: http://www.hcs.harvard.edu/csharp/Logo1.png

I am using cURL to fletch it. Then I am saving it to computer as picture.jpg, but the file is corrupted. It is not recognized as picture

What is the correct way of doing this ?

Thanks

Upvotes: 0

Views: 1795

Answers (3)

Tamara Wijsman
Tamara Wijsman

Reputation: 12348

Why not use System.Net.WebClient for this?

WebClient client = new WebClient();
client.DownloadFile("http://www.hcs.harvard.edu/csharp/Logo1.png", "Logo1.png");

Upvotes: 5

gkrogers
gkrogers

Reputation: 8356

Have you tried saving it as picture.png?

Upvotes: 1

Ian P
Ian P

Reputation: 12993

I don't completely understand the question, but my first thought is that saving a .png as .jpeg would be a good place to start investigating.

Upvotes: 4

Related Questions