Results 1 to 2 of 2
-
01-30-2012, 10:15 AM #1
- Join Date
- Apr 2008
- Location
- Boston, USA
- Posts
- 13,172
- Thanks
- 744
- Thanked 699 Times in 550 Posts
- Blog Entries
- 4
- Feedback Score
- 4 (100%)
Jpeg Image File Size Gets Too Big on Resize - Asp .Net
Jpeg Image File Size Gets Too Big on Resize - Asp .Net
If you save a Bitmap in a jpeg format with 100% quality, your saved jpeg file size might be lot bigger then your original file size.
To avoid this you have to specify the quality param for jpeg files.
Here is some example codes in C#, considering you are saving to jpeg from a Bitmap.
Code:System.Drawing.Imaging.ImageCodecInfo ici = GetImageCodec("image/jpeg"); System.Drawing.Imaging.EncoderParameters eps = new System.Drawing.Imaging.EncoderParameters(1); eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 75L); bmp.Save(imageFolderAbsolutePath + "/" + saveAsName, ici, eps); public ImageCodecInfo GetImageCodec(string mimetype) { mimetype = mimetype.ToLower(); foreach (ImageCodecInfo ici in ImageCodecInfo.GetImageEncoders()) { if (ici.MimeType.ToLower() == mimetype) return ici; } return null; }Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK
-
02-03-2012, 07:25 AM #2
Senior
- Join Date
- Jul 2011
- Posts
- 534
- Thanks
- 0
- Thanked 1 Time in 1 Post
- Feedback Score
- 0
thanx for sharing.....
Similar Threads
-
Create High Quality Thumbnail - Resize Image Dynamically - ASP .Net C# Code
By manik in forum ASPReplies: 18Last Post: 03-03-2012, 11:39 PM -
FFmpeg converting to flv but with 0 file size
By HemZone in forum Website & Server AdministrationReplies: 0Last Post: 01-05-2012, 06:35 AM -
Coldfusion - Saving the File Name for Image Uploader Applet
By Abina in forum ColdFusionReplies: 3Last Post: 12-17-2010, 05:48 AM -
Resize and upload the Image Error (Could not find the ColdFusion Component)
By Abina in forum ColdFusionReplies: 1Last Post: 02-02-2010, 11:35 AM -
Do search engines index ALT text descriptions for JPEG and other image files?
By dealsforums in forum Search EnginesReplies: 7Last Post: 08-28-2009, 02:43 AM


Reply With Quote

