Last active
February 3, 2017 20:59
-
-
Save mtyaka/6267472 to your computer and use it in GitHub Desktop.
Patches poppler's pdftocairo to be able to set jpeg quality parameter. Tested with pdftocairo 0.22.5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc | |
index bf7072c..743016d 100644 | |
--- a/utils/pdftocairo.cc | |
+++ b/utils/pdftocairo.cc | |
@@ -99,6 +99,7 @@ static GBool mono = gFalse; | |
static GBool gray = gFalse; | |
static GBool transp = gFalse; | |
static GooString icc; | |
+static int jpegQuality = -1; | |
static GBool level2 = gFalse; | |
static GBool level3 = gFalse; | |
@@ -127,6 +128,8 @@ static const ArgDesc argDesc[] = { | |
#if ENABLE_LIBJPEG | |
{"-jpeg", argFlag, &jpeg, 0, | |
"generate a JPEG file"}, | |
+ {"-jpegquality", argInt, &jpegQuality, 0, | |
+ "set JPEG quality (0 - 100)"}, | |
#endif | |
#if ENABLE_LIBTIFF | |
{"-tiff", argFlag, &tiff, 0, | |
@@ -293,9 +296,9 @@ void writePageImage(GooString *filename) | |
} else if (jpeg) { | |
#if ENABLE_LIBJPEG | |
if (gray) | |
- writer = new JpegWriter(JpegWriter::GRAY); | |
+ writer = new JpegWriter(jpegQuality, false, JpegWriter::GRAY); | |
else | |
- writer = new JpegWriter(JpegWriter::RGB); | |
+ writer = new JpegWriter(jpegQuality, false, JpegWriter::RGB); | |
#endif | |
} else if (tiff) { | |
#if ENABLE_LIBTIFF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment