Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading image from website and resizing it and displaying

Status
Not open for further replies.

nicklieb

Programmer
Oct 17, 2002
383
GB
I am developing a little noddy windows form, and have an image place holder on the form.

it's really quite simple, where user enters a part number whihc is then displayed in a datagrid. When user click on a row, an image is then displayed in the placeholder of that part.

there are around 12,000 images all of different sizes, and I cannot really be bother to go through the laboruous task of resizing every image.

So what i want to do is to resize the image when they are read from the webserver:

Code:
 HttpWebRequest wReq = HttpWebRequest)WebRequest.Create(sURL);
HttpWebResponse wRes = (HttpWebResponse)(wReq).GetResponse();
 str = wRes.GetResponseStream();
Image outputimg = Image.FromStream(str);
 outputimg.Height = 213;
 outputimg.Width = 284;
 return outputimg;

this does not work, as it say the Height and width are read only... and I can't seem to fin how you can set the image dimension when they are output.

thanks in advance.

 
found what i need.. for you info:


Code:
                HttpWebRequest wReq = (HttpWebRequest)WebRequest.Create(sURL);
                HttpWebResponse wRes = (HttpWebResponse)(wReq).GetResponse();
                str = wRes.GetResponseStream();
                   Size NewSize = new Size();
                NewSize.Height = strHeight;
                NewSize.Width = strWidth;
                Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallBack);
                Image outputimg = Image.FromStream(str).GetThumbnailImage(NewSize.Width, NewSize.Height, myCallback,IntPtr.Zero);

                
                return outputimg;

        public bool ThumbnailCallBack()
        {
            return false;
        }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top