×

OmniGraffle: Place Named Image

This is a shortcut for placing named images from your Photos collection into the current canvas of the frontmost OmniGraffle document.

INSTALL SHORTCUT ••• ↓ DOWNLOAD SHORTCUT

The shortcut processes places named images in two ways:

The shortcut will present a image picker for the system Photos library. Metadata for the image, such as its name or title, can be entered in the pickers search field.

Once the image is chosen, a choose dialog displaying the image’s dimensions as well as the percentages to be used for for scaling the selected image.

Place Named Images
A shortcut that places named images in the frontmost OmniGraffle document.

 1  Shortcut Input • This shortcut accepts input from selected images processed using the Share Sheet (iOS/iPadOS), or from those selected from the system image picker that displays the contents of default Photos library.

 2  “Open App” action • Make OmniGraffle the frontmost application.

 3  Create Variable • Store a reference to the chosen image.

 4-5  Image Properties • Store the width and height of the chosen image.

 6-7  Scaling Percentages • Display a list of scaling percentages (in 10% increments). The prompt includes the chosen image width and height.

Shortcut Workflow

 8-11  Calculate New Dimensions • Calculate the new dimensions for the scaled image.

 12  Scale Chosen Image • Resize the image data to the new dimensions.

 13  “Omni Automaton Script” action • The stored image title is placed in the Data Input Socket of this action.

 14  “Omni Automaton Script” action • The resized image data is placed in the “Associated Files” control of this action.

 15  “Omni Automaton Script” action • The first section of the script deals with placing the image in a selected shape, using the argument.files[0] parameter to retrieve the passed-in image data, and the argument.input parameter to retrieve the stored image title, which is then used as the text for the selected shape.

 16  “Omni Automaton Script” action • The second section of the script deals with placing the image in a new shape (sized to the image), using the argument.files[0] parameter to retrieve the passed-in image data, and the argument.input parameter to retrieve the stored image title, which is then used as the text for the selected shape.

Here is the Omni Automation script used to place the chosen image in the current canvas of the frontmost OmniGraffle document:

Place Named Image


try { var imageData = argument.files[0] var sel = document.windows[0].selection var cnvs = sel.canvas if (sel.solids.length === 1){ sel.solids[0].image = addImage(imageData) sel.solids[0].text = argument.input } else { var solid = cnvs.newShape() solid.strokeThickness = 0 solid.shadowColor = null solid.fillColor = null solid.image = addImage(imageData) var newGeometry = solid.geometry newGeometry.size = solid.image.originalSize solid.geometry = newGeometry solid.text = argument.input } } catch(err){ new Alert(err.name,err.message).show() }