Image Resize

Results 1 to 2 of 2

Thread: Image Resize

  1. #1
    Join Date
    Dec 1969

    Default Image Resize

    Arg, i cannot find one single example of the following.. not in either of my VB.NET books, no where on the net<BR><BR>I have an image on the server that just got uploaded<BR>I want an aspx page to go in afterwards, load the image (i&#039;ll feed it the full path), resize the image if its too big (wider than 550 pix), then save it...... done<BR><BR>but all the System.Drawing examples are way more different than the above<BR><BR>also, as "extra credit", can i add text to the image? like brand it with my site&#039;s name (in text of course)<BR><BR>Thanks in advance....

  2. #2
    Join Date
    Dec 1969

    Default RE: Image Resize

    This will resize the image and save it.<BR>You can write text on the image<BR>Charles Petzolds book on C# Windows programmming has good examples.<BR><BR>System.Drawing.Image imgOldImage; <BR> System.Drawing.Image imgNewImage;<BR> imgOldImage = System.Drawing.Image.FromStream(fImageLarge.Posted File.InputStream);<BR> int iSquare = 50;// the new size<BR> int cxThumbnail, cyThumbnail;<BR> if (imgOldImage.Width &#062; imgOldImage.Height)<BR> {<BR> cxThumbnail = iSquare;<BR> cyThumbnail = iSquare * imgOldImage.Height / imgOldImage.Width;<BR> }<BR> else<BR> {<BR> cyThumbnail = iSquare;<BR> cxThumbnail = iSquare * imgOldImage.Width / imgOldImage.Height;<BR> }<BR> imgNewImage =imgOldImage.GetThumbnailImage(cxThumbnail, cyThumbnail, null, (IntPtr)0); // resize from original<BR> //imgNewImage.Save(strPath);// save to strPath

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts