ImageMagick delegates the PDF->bitmap conversion to GhostScript anyway, so here's a command you can use (it's based on the actual command listed by the ps:alpha
delegate in ImageMagick, just adjusted to use JPEG as output):
gs -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT \
-dMaxBitmap=500000000 -dLastPage=1 -dAlignToPixels=0 -dGridFitTT=0 \
-sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r72x72 \
-sOutputFile=$OUTPUT -f$INPUT
जहां $ OUTPUT
और $ INPUT
आउटपुट और इनपुट फ़ाइल नाम हैं। आपको जो भी संकल्प चाहिए, उसे 72x72
समायोजित करें। (जाहिर है, यदि आप एक पंक्ति के रूप में पूरे कमांड को लिख रहे हैं तो बैकस्लेश को हटा दें।)
यह दो कारणों से अच्छा है:
- You don't need to have ImageMagick installed anymore. Not that I have anything against ImageMagick (I love it to bits), but I believe in simple solutions.
- ImageMagick does a two-step conversion. First PDF->PPM, then PPM->JPEG. This way, the conversion is one-step.
अन्य बातों पर विचार करने के लिए: जिन फ़ाइलों का मैंने परीक्षण किया है, पीएनजी जेपीईजी से बेहतर संपीड़ित करता है। यदि आप पीएनजी का उपयोग करना चाहते हैं, तो -sDEVICE = jpeg
को -sDEVICE = png16m
में बदलें।