3

I have a two-page PDF I'm trying to convert to a PNG file. When I run:

gs -sDevice=pngalpha -o=gs-output-%d.png -r400 test1-0.pdf

I get:

GPL Ghostscript 9.07 (2013-02-14)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
%%BoundingBox: 35 35 577 757
%%HiResBoundingBox: 35.910001 35.910001 576.090022 756.090029
Page 2
%%BoundingBox: 35 35 577 757
%%HiResBoundingBox: 35.910001 35.910001 576.090022 756.090029

And then... nothing. No output files at all. Where am I going wrong?

2 Answers 2

7

You're so close you'll be mad ;-)

After a bit of manpage reading here's what worked for me:

gs -sDEVICE=pngalpha -ogs-output-%d.png -r400 test1-0.pdf

i.e. DEVICE instead of Device, and -o instead of -o=

In case it matters, my gs version is:

GPL Ghostscript 9.05 (2012-02-08)
Sign up to request clarification or add additional context in comments.

1 Comment

Beautiful! Works like a charm on GPL Ghostscript 9.07 (2013-02-14) as well.
1

try this which works perfectly with me and it get a very good results:

-sDEVICE=pngalpha -o "$OUTPUTIMAGEFILE" -dFirstPage=1 -dLastPage=2 -dNOPAUSE -dGraphicsAlphaBits=4 -dTextAlphaBits=4   "$INPUTPDFFILE" 

However i guess that using -r400 is for JPEG images not PNGS

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.