Browse the docs

dpi

Returns the horizontal or vertical DPI of the image the running action works on.

Keyboard Maestro: DPI

Details #

dpi(axis) takes exactly one argument and returns a number. axis is "x" or "y"; anything other than y (compared without regard to case) is treated as x. Use "x" for the horizontal DPI and "y" for the vertical.

It reads the image the running action works on, which an action supplies in the image variable.

Parameters #

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

Examples #

dpi("x")
→ 72
Sample variableValue
image{"dpiX": 72, "dpiY": 144}
dpi("y")
→ 144
Sample variableValue
image{"dpiX": 72, "dpiY": 144}

Gotchas #

  • With no image to read it stops the step: dpi() needs an image: it reads the image the running action works on. The examples set a sample image variable so they run.

  • Calling it with no argument is an error: dpi() takes 1 argument, got 0.