clipboardimagesize(
)

The clipboardimagesize( function returns the dimensions of whatever image is currently on the computer’s clipboard.


Parameters

No parameters.


Description

This function returns the dimensions of whatever image is currently on the computer’s clipboard. The dimensions are returned as a rectangle (the top and left edges of the rectangle are always zero). This example is designed to save a screenshot as a PNG file, but with a maximum width of 700 points. The clipboardimagesize() function is used to check if the screen shot is too wide, and if so, to calculate the scaling factor to reduce it to the maximum allowed size.

let imageWidth = rwidth(clipboardimagesize())
let scaleFactor = 1.0
let maxWidth = 700
if imageWidth>maxWidth
    scaleFactor = maxWidth/imageWidth
endif
let shotName = "screenshot_"+datepattern(today(),"yyyy_mm_dd_")+timepattern(now(),"hh_mm_ss")+".png"
clipboardimagesave shotName,"scale",scaleFactor

See clipboardimagesave to learn how that statement saves an image on the clipboard as a file.


Error Messages

CliboardImageSize error (no image on clipboard) – An image must be copied onto the clipboard before using this function.


See Also


History

VersionStatusNotes
10.2NewNew in this version