[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-poppler
Subject: [poppler] goo/JpegWriter.cc
From: ajohnson () kemper ! freedesktop ! org (Adrian Johnson)
Date: 2012-01-26 22:23:51
Message-ID: 20120126222351.BB8E91004A () kemper ! freedesktop ! org
[Download RAW message or body]
goo/JpegWriter.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 641526d1a7e8032ea8f7b8ac42c5ad8c20448d9b
Author: Adrian Johnson <ajohnson@redneon.com>
Date: Wed Jan 25 22:44:27 2012 +1030
jpeg: set image parameters after jpeg_set_defaults()
so the resolution does not get overwritten by the defaults.
The libjpeg documentation for jpeg_set_defaults() states: "This
routine sets all JPEG parameters to reasonable defaults, using only
the input image's color space (field in_color_space, which must
already be set in cinfo)"
Bug 45224
diff --git a/goo/JpegWriter.cc b/goo/JpegWriter.cc
index 7ed5d52..aa11d8a 100644
--- a/goo/JpegWriter.cc
+++ b/goo/JpegWriter.cc
@@ -53,6 +53,10 @@ bool JpegWriter::init(FILE *f, int width, int height, int hDPI, int vDPI)
// Initialize libjpeg
jpeg_create_compress(&cinfo);
+ // Set colorspace and initialise defaults
+ cinfo.in_color_space = colorMode; /* colorspace of input image */
+ jpeg_set_defaults(&cinfo);
+
// Set destination file
jpeg_stdio_dest(&cinfo, f);
@@ -62,7 +66,6 @@ bool JpegWriter::init(FILE *f, int width, int height, int hDPI, int vDPI)
cinfo.density_unit = 1; // dots per inch
cinfo.X_density = hDPI;
cinfo.Y_density = vDPI;
- cinfo.in_color_space = colorMode; /* colorspace of input image */
/* # of color components per pixel */
switch (colorMode) {
case JCS_GRAYSCALE:
@@ -77,7 +80,6 @@ bool JpegWriter::init(FILE *f, int width, int height, int hDPI, int vDPI)
default:
return false;
}
- jpeg_set_defaults(&cinfo);
if (cinfo.in_color_space == JCS_CMYK) {
jpeg_set_colorspace(&cinfo, JCS_YCCK);
cinfo.write_JFIF_header = TRUE;
_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic