I'm working on a project where par of the requirements are to convert the first page of a PDF to a PNG. This in and of itself is relatively simple, but I've yet to find a way to scale the resulting output within gs.
The gs command I'm currently using is this:
gs -sDEVICE=png16m -dFirstPage=1 -dLastPage=1 -dBATCH -dNOPAUSE -dPDFFitPage -sOutputFile=out.png in.pdf
Following the conversion, I'm using another program to scale it down to where the larger of X or Y is 150px and the resulting image retains the original aspect ratio of the PDF I started with.
I've looked at the
-g flag, which looks like it would correctly scale my output, but would then mess with the resulting aspect ratio, creating a 150x150px square.
It's completely possible that this is just something gs can't do, but if there is a way to avoid starting up two separate processes to complete this task that would make me sleep better at night.