Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2004

Tip: Looking for answers? Try searching our database.

Png compression

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Franz - 21 Aug 2004 14:02 GMT
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();

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.