I want to ask about the png compression for Bitmap.Save
Here are the case :
Jpg (768 x 576 , 301KB) => Jpg (384 x 288, 22KB)
Jpg (768 x 576 , 301KB) => Png (384 x 288, 311KB)
Is the compression of png worst than that of jpg?
Here are the code :
Image image = Bitmap.FromFile(filePath);
int newWidth = (int)(percentage * image.Width);
int newHeight = (int)(percentage * image.Height);
Rectangle rectDest = new Rectangle(0, 0, newWidth, newHeight);
Bitmap bitmap = new Bitmap(rectDest.Width, rectDest.Height);
Graphics g = Graphics.FromImage(bitmap);
g.DrawImage(image, rectDest, 0, 0, image.Width, image.Height,
GraphicsUnit.Pixel);
image.Dispose();
bitmap.Save(filePath, format);
bitmap.Dispose();
Daniel O'Connell [C# MVP] - 21 Aug 2004 21:26 GMT
If memory serves, png is a lossless compression model. Because its lossless
it will almost always result in files that are larger than the equivilent
jpeg, which is a lossy compression system(that is, it throws data you don't
need away).
So, the compression is different and each format has a different purpose. If
you are looking into lossless compression for images go with png, if you are
looking for best quality\size ratio, jpeg will probably do you well.
>I want to ask about the png compression for Bitmap.Save
> Here are the case :
[quoted text clipped - 20 lines]
> bitmap.Save(filePath, format);
> bitmap.Dispose();