Richard Zillmann
Richard Zillmann

Reputation: 31

Ghostscript: How can I move/scale eps content on target image?

I want to create a png file from an eps file with ghostscript. But I want to put it on a bigger image and control exactly where and how big (this means, I want to scale and move it). I assume, that one should add some postscript commands in a "-c" argument to ghostscript. I tried arguments like -c " 0.8 0.8 scale " and -c " 1 1 moveto ". But in this case no png file was created, without other error message. My question: what is the proper way to do this?

Example command used by me:

gswin32c.exe -dPARANOIDSAFER -r288 -dDEVICEHEIGHTPOINTS=195 -dDEVICEWIDTHPOINTS=256 -c " 1 1 moveto " -sDEVICE=png16m -o "testout.png" "input.EPS"

Upvotes: 2

Views: 859

Answers (1)

KenS
KenS

Reputation: 31131

You need to read the Adobe EPSF specification

especially Section 2.6 "Graphics state". You will need to use scale as you suggest, and moveto. Note that 1 1 moveto moves the current point by 1/72 of an inch, so likely you won't be able to see any difference. Although you have used a -c switch to introduce PostScript, you haven't followed it with a -f to revert back to command line processing.

Try:

gswin32c.exe -sDEVICE=png16m -r288 -dDEVICEHEIGHTPOINTS=195 -dDEVICEWIDTHPOINTS=256 -sOutputFile="testout.png" -c "72 72 moveto" -f "input.EPS"

That should move the rendered image up and right by one inch each which you should be able to see. Using -sOutputFile rather than -o is in case you get something back on stdout. -o implies -dBATCH and -dNOPAUSE.

Upvotes: 1

Related Questions