Last post Dec 20, 2007 09:35 PM by Giovanni8089
May 25, 2007 02:12 PM|Slam|LINK
I have an url of an image, let's say http://myserver/image.gif
I need to create a System.Drawing.Image object from that file.
I tried to use method FromFile("http://myserver/image.gif") but this method does not support URI
Then I tried to create this Image object from a stream...
req.Timeout = System.Threading.
But the last line leads to exception: "System.NotSupportedException: This stream does not support seek operations.
I need an advice of how to reach my goal having just the image URL.
May 26, 2007 01:46 AM|DMW|LINK
What you're doing is pretty much OK, upto the point that you try to use the response stream directly.
There are a couple of approaches that you can take:
1. You can create a temporary file, copy the response into that and then open the image from the file.
2. Create a MemoryStream, copy the reponse stream into the memory stream and then open the image from the MemoryStream.
Which option you take tends to depend on whether you prefer using temporary files (which have to be cleaned up) or a little more memory.
May 26, 2007 09:54 AM|Slam|LINK
Thanks. Here is the solution...
Dec 20, 2007 09:35 PM|Giovanni8089|LINK
Thanks for the solution, this really helped me!