am trying to display an image in a "toolStrip" i c# from a weburl. Am using the following methode to get the image
WebRequest requestPic5 = WebRequest.Create(icon_path);
requestPic5.Timeout = 5000;
WebResponse responsePic5 = null;
Image Myimg5 = null;
if (requestPic5 != null)
{
responsePic5 = requestPic5.GetResponse();
if (responsePic5 != null)
{
Myimg5 = Image.FromStream(responsePic5.GetResponseStream());
}
}
its failing when Myimg5 = Image.FromStream(responsePic5.GetResponseStream());
throws an exception but the image is still there in the url
But unfortunately most of the time its not loading properly and sometimes throwing a 404 error
It should compile fine using commercially available C/C++ compilers. The software works on 8-bit, gray scale images in TIFF and BMP file formats. Inexpensive programs are available to convert almost any image into one of these formats. Chapter 0 introduces the C Image Processing System.
// stb_image supports loading HDR images in general, and currently the Radiance. // .HDR file format specifically. You can still load any file through the existing. // interface; if you attempt to load an HDR file, it will be automatically remapped.
Function stbi_load returns a pointer to an unsigned char* buffer. The size of this buffer is width * height * channels . The image data is stored in the buffer in row order, i.e., the first width * channels bytes belong to the first row of image. The following code sets the first 10 rows of the input image to black.
The response stream has other stuff that you don't necessarily want. You really just want the raw data of the imgage file, so you can use:
new MemoryStream(new WebClient().DownloadData("http://address/file.ico"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With