F
funcSter
Hey, got a prob which is driving me nuts!
I'm trying to resize the resolution of an image as well as it's pyhsical byte size.
I've got:
byte[] bytImage = null;
System.Drawing.Image imgImage = null;
System.Drawing.Image imgNewImage = null;
using(FileStream fs = File.OpenRead(@"C:\Images\Test.jpg"))
{
bytImage = new byte[fs.Length];
fs.Read(bytImage, 0, (int)fs.Length);
imgImage = System.Drawing.Image.FromStream(fs);
fs.Close();
}
imgNewImage = new Bitmap(imgImage, 200, 200);
imgNewImage.Save(@"C:\Images\Test_1.jpg"))
What's goin wrong is this:
Test.jpg is originally 400 x 600, with PixelFormat = Format24bppRgb
Test_1.jpg is 200 x 200 BUT with PixelFormat = Format32bppARgb
So I tend to get my resized images file bigger in byte size than the original!
How do I rectify this? Or is there a better alternative to resizing an Image?
I'm trying to resize the resolution of an image as well as it's pyhsical byte size.
I've got:
byte[] bytImage = null;
System.Drawing.Image imgImage = null;
System.Drawing.Image imgNewImage = null;
using(FileStream fs = File.OpenRead(@"C:\Images\Test.jpg"))
{
bytImage = new byte[fs.Length];
fs.Read(bytImage, 0, (int)fs.Length);
imgImage = System.Drawing.Image.FromStream(fs);
fs.Close();
}
imgNewImage = new Bitmap(imgImage, 200, 200);
imgNewImage.Save(@"C:\Images\Test_1.jpg"))
What's goin wrong is this:
Test.jpg is originally 400 x 600, with PixelFormat = Format24bppRgb
Test_1.jpg is 200 x 200 BUT with PixelFormat = Format32bppARgb
So I tend to get my resized images file bigger in byte size than the original!
