http://bugzilla.novell.com/show_bug.cgi?id=506179
Summary: unable to set different quality when saving JPEG
images using Bitmap object
Classification: Mono
Product: Mono: Class Libraries
Version: unspecified
Platform: 64bit
OS/Version: openSUSE 11.1
Status: NEW
Severity: Major
Priority: P5 - None
Component: libgdiplus
AssignedTo: [email protected]
ReportedBy: [email protected]
QAContact: [email protected]
Found By: ---
User-Agent: Opera/9.64 (Windows NT 5.1; U; pl) Presto/2.1.1
I'm trying to save JPEG image with 100% quality, but it is always saved with
some kind of default compression, about 85%. I'm using below code:
CODE:
Bitmap bmp = new Bitmap(w,h);
BitmapData bmpdata = bmp.LockBits(new Rectangle, 0, 0, w, h),
ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
//Filling image with data - works for sure
bmp.UnlockBits(bmpdata);
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
ImageCodecInfo myCodec=null;
foreach(ImageCodecInfo codec in codecs)
{
if(codec.MimeType == "image/jpeg")
{
myCodec = codec;
break;
}
}
if(myCodec == null)
throw new Exception("no jpeg codec found?!");
EncoderParameters eps = new EncoderParameters(1);
eps.Param[0] = new EncoderParameter( Encoder.Quality, 100L );
bmp.Save("myfile.jpg", myCodec, eps );
bmp.Dispose();
END-OF-CODE
It works on .NET platform.
Reproducible: Always
Steps to Reproduce:
1. Create Bitmap object or load a bmp.
2. Prepare jpeg ImageCodecInfo
3. Set EncoderParameters quality to an extreme value (e.g. 1 or 100)
4. Try to save image with ImageCodecInfo and EncoderParameters defined above.
Actual Results:
Saved image has always 85% quality.
Expected Results:
The image should be compressed according to Encoder Parameter
This is serious problem, becouse of loosing image data after saving to
compressed file.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs