You can resize the image using the GetThumbnailImage method.
Here's more info:
http://msdn.microsoft.com/library/de...ImageTopic.asp
Or maybe you'll find these custom functions I wrote to be useful:
public Image DisplaySize(Bitmap bmp)
{
Response.Write(bmp.Width.ToString());
Response.Write(bmp.Height.ToString());
}
//shrink the image proportionately so that neither height nor width is
//more than [NewSize] pixels
public System.Drawing.Image ShrinkImage(System.Drawing.Bitmap bmp, int
NewSize)
{
double NewWidth;
double NewHeight;
double ShrinkPercent;
System.Drawing.Image.GetThumbnailImageAbort myCallback =
new System.Drawing.Image.GetThumbnailImageAbort(Thumbn ailCallback);
if (bmp.Width>bmp.Height)
{
NewWidth=NewSize;
ShrinkPercent=(NewWidth/bmp.Width)*100;
NewHeight=(ShrinkPercent/100)*bmp.Height;
}
else
{
NewHeight=NewSize;
ShrinkPercent=(NewHeight/bmp.Height)*100;
NewWidth=(ShrinkPercent/100)*bmp.Width;
}
System.Drawing.Image myShrunkenImage =
bmp.GetThumbnailImage((int)NewWidth,(int)NewHeight ,myCallback,IntPtr.Zero);
return myShrunkenImage;
}
public bool ThumbnailCallback(){return false;}
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
Hello,
In each record of an ASP.Net Repeater I have an image which original size
is 200px width and with a height which can vary from record to record.
How can I resize each image to 50px and keep its proportion?
Does anyone know how to do this?
Thank You,
Miguel