Bitmap Compression
page 1 of 1
Published: 25 Mar 2004
Unedited - Community Contributed
By default the JPEG files that GDI+ outputs can sometimes look a little crummy. This is because they are not output at the highest possible quality. While this can be frustrating if outputting something that requires clean lines, such as text, you rarely notice much with photographs. But what about if you need your picture to look crisp but can not use an alternative format such as GIF or PNG?
by Chris Garrett
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 14212/ 22

Bitmap Compression


What if you really need a crisp JPG image?  Luckily GDI+ has hidden in it's ample folds a facility to allow you to set the quality of your JPG output and (thankfully) it is a really simple thing to do.


low quality






view source (c#)



download source (c#)



download source (vb)


User Comments

Title: Compression   
Name: Jacky
Date: 2009-02-05 7:53:00 AM
THANKS A TON for you'r vb code!!!!!!
It works great!!!!!!
Title: PNG Compression   
Name: Mark
Date: 2006-06-04 10:18:46 PM
What about compression for PNG files? The new web standard will be PNG and not JPG soon, and I need to compress my generated png images before saving them to my web server. Right now, my 180x100 product images are being saved at 50kb each, and I show 12 product images per page, so thats a total of 600kb! I need compression for PNG please!

I tried just changing the code from:

If (arrayICI(x).FormatDescription.Equals("JPEG")) Then


If (arrayICI(x).FormatDescription.Equals("PNG")) Then

but that doesn't help.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-04-18 2:35:42 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search