+
+ // 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(wxIMAGE_OPTION_QUALITY))
+ jpeg_set_quality(&cinfo, image->GetOptionInt(wxIMAGE_OPTION_QUALITY), TRUE);
+
+ // set the resolution fields in the output file
+ int resX, resY;
+ wxImageResolution res = GetResolutionFromOptions(*image, &resX, &resY);
+ if ( res != wxIMAGE_RESOLUTION_NONE )
+ {
+ cinfo.X_density = resX;
+ cinfo.Y_density = resY;
+
+ // it so happens that wxIMAGE_RESOLUTION_INCHES/CM values are the same
+ // ones as used by libjpeg, so we can assign them directly
+ cinfo.density_unit = res;
+ }
+