Browse the docs

sourceDpi

Returns the horizontal or vertical resolution in dots per inch of the source image of the running action.

Keyboard Maestro: SOURCEDPI

Details #

sourceDpi(axis) takes exactly one argument and returns a number. axis is "x" or "y", not case-sensitive; anything other than y gives the horizontal value.

It reads the sourceImage variable that the image steps fill in while they run, using its dpiX or dpiY.

Parameters #

Takes 1 argument. {{ sourceDpi(text) }}

Examples #

sourceDpi("x")
→ 144
Sample variableValue
sourceImage{"dpiX": 144, "dpiY": 144, "height": 600, "width": 800}
sourceDpi("y")
→ 72
Sample variableValue
sourceImage{"dpiX": 144, "dpiY": 72, "height": 600, "width": 800}

Gotchas #

  • Outside an image step there is no sourceImage and it stops: sourceDpi() needs an image: it reads the image the running action works on.