diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-08-17 19:27:02 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-08-17 19:27:02 +0200 |
commit | 822ce1df6773e1934f50d035756ecca0f6d4cae1 (patch) | |
tree | 30950a220566092ac35f1367e49b701afa85b3e2 /apps | |
parent | 4214d2a553522a9ebb5c263368131aea813ebe03 (diff) | |
download | mupdf-822ce1df6773e1934f50d035756ecca0f6d4cae1.tar.xz |
pdfdraw: Add command line option to gamma correct and invert images.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/man/pdfdraw.1 | 7 | ||||
-rw-r--r-- | apps/pdfdraw.c | 13 |
2 files changed, 19 insertions, 1 deletions
diff --git a/apps/man/pdfdraw.1 b/apps/man/pdfdraw.1 index 67899640..53fbcde9 100644 --- a/apps/man/pdfdraw.1 +++ b/apps/man/pdfdraw.1 @@ -59,6 +59,13 @@ Print the display list used to render each page. .TP .B \-A Disable the use of accelerated functions. +.TP +.B \-G gamma +Gamma correct the output image. +Some typical values are 0.7 or 1.4 to thin or darken text rendering. +.TP +.B \-I +Invert the output image colors. .SH SEE ALSO .BR mupdf (1), .BR pdfclean (1). diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c index 4dd24ff2..a5f6aa1e 100644 --- a/apps/pdfdraw.c +++ b/apps/pdfdraw.c @@ -22,6 +22,8 @@ int showmd5 = 0; int savealpha = 0; int uselist = 1; int alphabits = 8; +float gamma_value = 1; +int invert = 0; fz_colorspace *colorspace; fz_glyph_cache *glyphcache; @@ -57,6 +59,8 @@ static void usage(void) "\t-d\tdisable use of display list\n" "\t-5\tshow md5 checksums\n" "\t-R -\trotate clockwise by given number of degrees\n" + "\t-G gamma\tgamma correct output\n" + "\t-I\tinvert output\n" "\tpages\tcomma separated list of ranges\n"); exit(1); } @@ -178,6 +182,11 @@ static void drawpage(pdf_xref *xref, int pagenum) pdf_run_page(xref, page, dev, ctm); fz_free_device(dev); + if (invert) + fz_invert_pixmap(pix); + if (gamma_value != 1) + fz_gamma_pixmap(pix, gamma_value); + if (output) { char buf[512]; @@ -295,7 +304,7 @@ int main(int argc, char **argv) fz_error error; int c; - while ((c = fz_getopt(argc, argv, "o:p:r:R:Aab:dgmtx5")) != -1) + while ((c = fz_getopt(argc, argv, "o:p:r:R:Aab:dgmtx5G:I")) != -1) { switch (c) { @@ -312,6 +321,8 @@ int main(int argc, char **argv) case '5': showmd5++; break; case 'g': grayscale++; break; case 'd': uselist = 0; break; + case 'G': gamma_value = atof(fz_optarg); break; + case 'I': invert++; break; default: usage(); break; } } |