clipboardimagesave
clipboardimagesave
PATH
,
OPTION
,
VALUE

The clipboardimagesave statement saves an image on the clipboard as an image file (.jpg, .png, etc.).

Parameters

This statement has three parameters:

path – the path and filename of the image file.

option – this and the following parameter are optional, and may also be repeated. It specifies an option for modifying the operation of the clipboardimagesave statement. See the text below for details.

value – value of the option.

Description

The clipboardimagesave statement allows you to save the contents of the clipboard as an image file. Of course this only works if the clipboard contains an image, if it contains text or any other type of data, this statement will stop the procedure with an error. This example will save the image in the clipboard to a file named flower.jpg in the same folder as the current database.

    clipboardimagesave "flower.jpg"

By specifying a path, the file can be placed anywhere on your disk.

    clipboardimagesave "~/Desktop/flower.jpg"

### Image Type

Normally the image type is specified by the extension of the saved file – choose from .jpg (or .jpeg), .png, .gif, .tiff (or .tif) or .bmp.

You can also use the `TYPE` option to explicitly specify the image type, for example:

     clipboardimagesave "~/Desktop/flower","TYPE","TIFF"

The type may be upper or lower case.

It’s possible to create an image file that has a type that conflicts with the file extension.

    clipboardimagesave "~/Desktop/flower.jpg","TYPE","PNG"

However, we don’t recommend doing this.

### JPEG Image Compression

Images saved in the JPEG format are compressed. Using compression saves disk space, but reduces the quality of the image. Use the `COMPRESSION` option to specify how much compression should be used. The compression may be from 1.0 (minimal compression) to 0.25 (very compressed). This example saves the flower image with 40% compression.

    clipboardimagesave "flower.jpg","COMPRESSION",0.4

If you don’t specify the compression factor, the default value of 0.7 is used. If the image type being saved doesn’t support compression, the compression factor will be ignored.

### Image Scale

This statement normally saves the image at the same size it was on the clipboard. However, you can specify a scale factor to reduce or enlarge the image. If the scale factor is less than 1, the image will be reduced, if it is larger than one, it will be enlarged. This code saves the image at half size (50% = 0.5).

    clipboardimagesave "flower.jpg","SCALE",0.5

This code saves the image at double size (200% = 2.0).

    clipboardimagesave "flower.jpg","SCALE",2.0

If you don’t specify a scale, then 1.0 (100%) is used.

### Image Resolution

To specify the resolution of the saved image, use the DPI option (dots per inch). This example saves the flower at 144 DPI.

    clipboardimagesave "flower.jpg","DPI",144

If the DPI is not specified, the DPI used by the image on the clipboard will be retained.

Note: Increasing the DPI doesn’t magically create new image data. If the original image is 72 DPI, you can save the image at 144 DPI, 300 DPI, or higher, but the image won’t actually be any sharper. It will, however, take up much more disk space.

### Combining Multiple Options

It’s possible to use multiple options at a time, just separate them with commas.

    clipboardimagesave "flower.jpg","scale",0.5,"dpi",144,"compression",0.6

As shown above, the option names can be in either upper or lower case, or any combination.

Error Messages

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

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.
- clipboardimagesize( -- returns the dimensions of whatever image is currently on the computer's clipboard.
- 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.