maxImportedImageSize Property

Description

The maxImportedImageSize property is used to set the maximum size of images imported into diagrams. The value of this property is a pixel area computed as the product of the image width and height (in pixels). During image import, an image with pixel area greater than this value will be resampled at a lower resolution. The pixel area of the imported image will be less than or equal to the value of this property.

To set this property, use the ESDWeb object's set method, as illustrated in the examples below, or pass it to the startup method as part of the configuration parameter.

The value of this property must be undefined or a number greater than or equal to zero.

Setting maxImportedImageSize to zero will disable the image import feature. In this case, this property must be set before the startup method is called. Example 2 below illustrates this.

Setting maxImportedImageSize to undefined eliminates the limit on the size of imported images. Example 3 below illustrates this.

The default maximum imported image size is 1,000,000.

The property scaledJPEGImageQuality controls the amount of compression applied when JPEG images are scaled during import.

Example 1 — Set Maximum Imported Image Size

editor = new ESDWeb(null, 'editorNode');

editor.startup(...);

// Set the maximum image import size to 1600px x 900px.
editor.set('maxImportedImageSize', 1600 * 900);
// Set the quality level to be used when down sizing JPEG images to 0.65.
editor.set('scaledJPEGImageQuality', 0.65);
		

Example 2 — Disabling Image Import

editor = new ESDWeb(null, 'editorNode');

// Disable image import
editor.set('maxImportedImageSize', 0);

editor.startup(...);
		

Example 3 — Remove Limits on Imported Image Size

editor = new ESDWeb(null, 'editorNode');

// No limits on the size of imported images...
editor.set('maxImportedImageSize', undefined);

editor.startup(...);