diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2013-08-24 21:25:51 +0930 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2013-08-26 06:40:35 +0930 |
commit | af4f2b775946815b572622bf4c4d42ad3aea1141 (patch) | |
tree | b0e0db416ed04d7526560c15fa4d9c6578f05f07 | |
parent | 25e96b6ddbbe54a75ddb97d2e235c1bd6033fe79 (diff) |
pdfimages: Add -all option to write all image in their native format
-rw-r--r-- | utils/pdfimages.1 | 4 | ||||
-rw-r--r-- | utils/pdfimages.cc | 23 |
2 files changed, 21 insertions, 6 deletions
diff --git a/utils/pdfimages.1 b/utils/pdfimages.1 index 5a87573d..a841ad75 100644 --- a/utils/pdfimages.1 +++ b/utils/pdfimages.1 @@ -87,6 +87,10 @@ Encoding uses 0 for black and 1 for white Input data fills from most significant bit to least significant bit. .RE .TP +.B \-all +Write JPEG, JPEG2000, JBIG2, and CCITT images in their native format. All other images are written as PNG files. +This is equivalent to specifying the options \-png \-j \-jp2 \-jbig2 \-ccitt. +.TP .B \-list Instead of writing the images, list the images along with various information for each image. Do not specify an .IR image-root diff --git a/utils/pdfimages.cc b/utils/pdfimages.cc index 86ba3b79..ae05c8b5 100644 --- a/utils/pdfimages.cc +++ b/utils/pdfimages.cc @@ -56,6 +56,7 @@ static GBool dumpJPEG = gFalse; static GBool dumpJP2 = gFalse; static GBool dumpJBIG2 = gFalse; static GBool dumpCCITT = gFalse; +static GBool allFormats = gFalse; static GBool pageNames = gFalse; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; @@ -84,6 +85,8 @@ static const ArgDesc argDesc[] = { "write JBIG2 images as JBIG2 files"}, {"-ccitt", argFlag, &dumpCCITT, 0, "write CCITT images as CCITT files"}, + {"-all", argFlag, &allFormats, 0, + "equivalent to -png -j -jp2 -jbig2 -ccitt"}, {"-list", argFlag, &listImages, 0, "print list of images instead of saving"}, {"-opw", argString, ownerPassword, sizeof(ownerPassword), @@ -189,12 +192,20 @@ int main(int argc, char *argv[]) { // write image files imgOut = new ImageOutputDev(imgRoot, pageNames, listImages); if (imgOut->isOk()) { - imgOut->enablePNG(enablePNG); - imgOut->enableTiff(enableTiff); - imgOut->enableJpeg(dumpJPEG); - imgOut->enableJpeg2000(dumpJP2); - imgOut->enableJBig2(dumpJBIG2); - imgOut->enableCCITT(dumpCCITT); + if (allFormats) { + imgOut->enablePNG(gTrue); + imgOut->enableJpeg(gTrue); + imgOut->enableJpeg2000(gTrue); + imgOut->enableJBig2(gTrue); + imgOut->enableCCITT(gTrue); + } else { + imgOut->enablePNG(enablePNG); + imgOut->enableTiff(enableTiff); + imgOut->enableJpeg(dumpJPEG); + imgOut->enableJpeg2000(dumpJP2); + imgOut->enableJBig2(dumpJBIG2); + imgOut->enableCCITT(dumpCCITT); + } doc->displayPages(imgOut, firstPage, lastPage, 72, 72, 0, gTrue, gFalse, gFalse); } |