Commandline equivalent of PDF export with preview

pdfpreviewterminal

I have several PNG images that I intend to include in a LaTeX document, but it does horrible things to non-vector images. I've been using preview to export the PNG as a PDF which remedies the problem.

I'd like to script this, so what would be the equivalent command in terminal to:

  1. Open specified PNG file
  2. Export as PDF to a file
  3. Specify the page orientation (as it defaults to portrait which is rotating all my images 90˚

Pretty much any solutions considered, applescript, automator, shell etc.

Best Answer

This can be completed with the following Automator service workflow:

The Size Each Page to Fit option preserves the orientation of the original image(s) in my testing, so no rotation is required.