hi,
how to resize an image to low size means i have images with size 140kb and 120kb and 90kb
i want to resize these images to bellow 50kb
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Master BillaPosted Sep 18, 2009, 10:35 AM
Here code
{
int sourceWidth = imgToResize.Width;
int sourceHeight = imgToResize.Height;
float nPercent = 0;
float nPercentW = 0;
float nPercentH = 0;
nPercentW = ((float)size.Width / (float)sourceWidth);
nPercentH = ((float)size.Height / (float)sourceHeight);
if (nPercentH < nPercentW)
nPercent = nPercentH;
else
nPercent = nPercentW;
int destWidth = (int)(sourceWidth * nPercent);
int destHeight = (int)(sourceHeight * nPercent);
Bitmap b = new Bitmap(destWidth, destHeight);
Graphics g = Graphics.FromImage((Image)b);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(imgToResize, 0, 0, destWidth, destHeight);
g.Dispose();
return (Image)b;
}
Thank you
Pramod Kumar NandagiriPosted Sep 19, 2009, 2:13 AM
is there any way to decrease the size of a jpeg image with out much effecting the height and width of that image
i want 250kb image compressed to 40kb with out effecting the height and width of the image
*******************************************************************************
another reqirement is: do u know about desktop resizing using c#.net then help me in this also
with my c#program i want to resize my pc desktop(it's not screen resolution , it's a monitor resolution)
Roei BarPosted Sep 18, 2009, 7:44 AM
http://www.codeproject.com/KB/graphics/quick_snip.aspx