]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagjpeg.cpp
Generic tree control fixes
[wxWidgets.git] / src / common / imagjpeg.cpp
index 5e3f56ce3418c9592a759b4d34d6ae6291f8a60e..8d6496294002c7a76c9f73baa636fd1c81cdc4d2 100644 (file)
@@ -325,6 +325,16 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
     cinfo.input_components = 3;
     cinfo.in_color_space = JCS_RGB;
     jpeg_set_defaults(&cinfo);
+
+    // TODO: 3rd parameter is force_baseline, what value should this be?
+    // Code says: "If force_baseline is TRUE, the computed quantization table entries
+    // are limited to 1..255 for JPEG baseline compatibility."
+    // 'Quality' is a number between 0 (terrible) and 100 (very good).
+    // The default (in jcparam.c, jpeg_set_defaults) is 75,
+    // and force_baseline is TRUE.
+    if (image->HasOption(wxT("quality")))
+        jpeg_set_quality(&cinfo, image->GetOptionInt(wxT("quality")), TRUE);
+
     jpeg_start_compress(&cinfo, TRUE);
 
     stride = cinfo.image_width * 3;    /* JSAMPLEs per row in image_buffer */