1

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.

1

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.

  • I'm familiar with creating 'drag-and-drop' automator shortcuts, can the automator functionality be output as a script too? – Joe Healey Apr 30 '17 at 12:00
  • 1
    @Joe This is an image file service service, so from Finder (or other app) you can right-click on an image, choose Services then this service and the workflow will run with the selected file as input. Is this suitable? What kind of script are you looking for? – grg Apr 30 '17 at 12:03
  • I think this solution will work thanks. My specific query about having the functionality as a script would be so that I could chain it to the output of the Rscript that currently generates the image (basically I'm being lazy, and wanted to string it all together (else what are computers for? :P )). – Joe Healey Apr 30 '17 at 12:06
  • 1
    @Joe Healey, if you want to do it via the command line or in a script, ImageMagick has a convert command that can do it. – user3439894 Apr 30 '17 at 12:41
  • 1
    @Joe You can run this Automator service from a shell using the automator command, I will look when I’m back at my computer. – grg Apr 30 '17 at 12:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .