1
votes

I am running with crazy issue in ghostscript 9.15.I have two commands for converting PDF to JPEG images,which has difference in height and width only.

Command 1st

-q -dUseCropBox -dBATCH -dDOINTERPOLATE -dMaxBitmap=300000000 -dAlignToPixels=0 -dNOPAUSE -dSAFER -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dPDFFitPage -dPrinted=false -r144 -g200x200 -sDEVICE=jpeg -dJPEGQ=100 -sOutputFile="output.jpg" "input.pdf" -c quit

Command 2nd

-q -dUseCropBox -dBATCH -dDOINTERPOLATE -dMaxBitmap=300000000 -dAlignToPixels=0 -dNOPAUSE -dSAFER -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dPDFFitPage -dPrinted=false -r144 -g200x199 -sDEVICE=jpeg -dJPEGQ=100 -sOutputFile="output.jpg" "input.pdf" -c quit

As you can see, command has difference in -g parameter only.

In first command I have used -g200x200 and in second command -g200x199.

First command gives rotated JPEG while second command gives UN-rotated JPEG file.Is there any utility inside ghostscript which differentiate my command from height and width perspective.

How should I get UN-rotated JPEG image file by using same height and width(-g200x200) while converting PDF to JPEG image file ?

1

1 Answers

0
votes

The main answer is 'don't use PDFFitPage'. That feature automatically rotates the output to fit 'best' on the declared media. If that isn't an option then you will have to do some PostScript programming.

You can fnd the code which does the resizing (and rotation) in ghostpdl/gs/Resource/Init/pdf_main.ps, the function /pdf_PDF2PS_matrix