clipboardimagesize(
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

- clear -- deletes the contents of the current cell without touching the clipboard.
- clipboard( -- returns whatever text is currently on the computer's clipboard.
- clipboardimagesave -- saves an image on the clipboard as an image file (.jpg, .png, etc.).
- copy -- copies the contents of the current field onto the clipboard.
- cut -- deletes the contents of the current field, copying it onto the clipboard.
- Fixed Image Object -- is used for fixed images (images that never change).
- Image Display Animations -- animated images.
- Image Display Colors and Gradients -- displaying pure colors and gradients
- Image Display Data Buttons -- checkboxes and radio buttons created from custom images.
- Image Display Object -- is used for dynamic images (images that change depending on the data).
- Image Display Push Buttons -- push buttons created from custom images.
- imagedimensions( -- returns the dimensions (height and width) of an image file.
- imageinfo( -- returns information about an image file on disk.
- paste -- pastes the contents of the clipboard into the current field.
- scrapcalc -- calculates a formula and stores the result in the clipboard. (Note: The same effect can be achieved by putting the word *clipboard* on the left side of an assignment.)

History

Version | Status | Notes
10.2 | New | New in this version