G Guest Jun 1, 2004 #1 I want to get the pixel size of a image file, which is specified by its URL. The problem is how to load the image file by a URL, and then how to get its size? I'm looking for any useful advices.
I want to get the pixel size of a image file, which is specified by its URL. The problem is how to load the image file by a URL, and then how to get its size? I'm looking for any useful advices.
S Scott Allen Jun 1, 2004 #2 ..NET makes this pretty easy using classes from the System.Drawing and System.NET namespaces: string imageUrl = "http://msdn.microsoft.com/nodehomes/graphics/80x60/aspnet.jpg"; WebRequest request = WebRequest.Create(imageUrl); WebResponse response = request.GetResponse(); Image image = Image.FromStream(response.GetResponseStream()); Console.WriteLine("Image size: {0}x{1}", image.Width, image.Height); HTH,
..NET makes this pretty easy using classes from the System.Drawing and System.NET namespaces: string imageUrl = "http://msdn.microsoft.com/nodehomes/graphics/80x60/aspnet.jpg"; WebRequest request = WebRequest.Create(imageUrl); WebResponse response = request.GetResponse(); Image image = Image.FromStream(response.GetResponseStream()); Console.WriteLine("Image size: {0}x{1}", image.Width, image.Height); HTH,