--- frontend/scanimage.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/frontend/scanimage.c b/frontend/scanimage.c index ffb9f105..e5562815 100644 --- a/frontend/scanimage.c +++ b/frontend/scanimage.c @@ -1213,7 +1213,7 @@ write_png_header (SANE_Frame format, int width, int height, int depth, int dpi, #ifdef HAVE_LIBJPEG static void -write_jpeg_header (SANE_Frame format, int width, int height, FILE *ofp, struct jpeg_compress_struct *cinfo, struct jpeg_error_mgr *jerr) +write_jpeg_header (SANE_Frame format, int width, int height, int dpi, FILE *ofp, struct jpeg_compress_struct *cinfo, struct jpeg_error_mgr *jerr) { cinfo->err = jpeg_std_error(jerr); jpeg_create_compress(cinfo); @@ -1238,6 +1238,11 @@ write_jpeg_header (SANE_Frame format, int width, int height, FILE *ofp, struct j } jpeg_set_defaults(cinfo); + /* jpeg_set_defaults overrides density, be careful. */ + cinfo->density_unit = 1; /* Inches */ + cinfo->X_density = cinfo->Y_density = dpi; + cinfo->write_JFIF_header = TRUE; + jpeg_set_quality(cinfo, 75, TRUE); jpeg_start_compress(cinfo, TRUE); } @@ -1393,7 +1398,8 @@ scan_it (FILE *ofp) #ifdef HAVE_LIBJPEG case OUTPUT_JPEG: write_jpeg_header (parm.format, parm.pixels_per_line, - parm.lines, ofp, &cinfo, &jerr); + parm.lines, resolution_value, + ofp, &cinfo, &jerr); break; #endif } @@ -1665,7 +1671,8 @@ scan_it (FILE *ofp) #ifdef HAVE_LIBJPEG case OUTPUT_JPEG: write_jpeg_header (parm.format, parm.pixels_per_line, - parm.lines, ofp, &cinfo, &jerr); + parm.lines, resolution_value, + ofp, &cinfo, &jerr); break; #endif } -- 2.12.2 -- sane-devel mailing list: sane-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to sane-devel-requ...@lists.alioth.debian.org