Browse the docs

sourceImage

Returns the width or height in pixels of the source image of the running action (for example the one being composited onto another).

Keyboard Maestro: SOURCEIMAGE

Details #

sourceImage(dimension) takes exactly one argument and returns a number. dimension is "width" or "height", not case-sensitive; anything other than height gives the width.

It reads the sourceImage variable, a record with width, height, dpiX and dpiY that the image steps fill in while they run.

Parameters #

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

Examples #

sourceImage("width")
→ 1920
Sample variableValue
sourceImage{"dpiX": 72, "dpiY": 72, "height": 1080, "width": 1920}
sourceImage("height")
→ 1080
Sample variableValue
sourceImage{"dpiX": 72, "dpiY": 72, "height": 1080, "width": 1920}

Gotchas #

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

  • The unit is pixels.