Place Image in OmniGraffle
Here is a useful Shortcut workflow for the Share menu that imports the selected image or image file into the current OmniGraffle document.
Available by tapping the Shortcuts Share menu item 1 in the Photos app, Files app, or any app supporting photos, when an image or image file is selected, and then the “Place Image in OmniGraffle” shortcut 2 in the list of available shortcuts. (see below)
The workflow will scale the image copy to the percentage value you choose, and then place the scaled version in either the currently selected graphic solid or a newly created gra[hic that is sized-to-fit the scaled image.
|
The Place Image Script
The Omni Automation script performs the following two functions:
- Convert the encoded image data passed into it by the workflow into an image
- Place the image into either the already selected single shape or a new shape sized to fit the passed image
A percent-encoded version of the script containing a text placeholder for the image data is inserted into the shortcut workflow as the contents of Text action.
Place Image in OmniGraffle
try {
var imageData = Data.fromBase64('XXXXX')
var sel = document.windows[0].selection
var cnvs = sel.canvas
if (sel.solids.length === 1){
sel.solids[0].image = addImage(imageData)
} 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
}
} catch(err){
new Alert(err.name,err.message).show()
}
The Shortcut Workflow
The following image capture shows the Shortcut workflow that is triggered fro the Share sheet.
You can INSTALL the shortcut workflow file.