maxImportedImageSize
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.
Use the set method of the ESDWeb object to set the value of this property 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 window.__editor(undefined, document.getElementById('editor-node'));
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 window.__editor(undefined, document.getElementById('editor-node'));
// Disable image import
editor.set('maxImportedImageSize', 0);
editor.startup(...);
Example 3 — Remove Limits on Imported Image Size
editor = new window.__editor(undefined, document.getElementById('editor-node'));
// No limits on the size of imported images...
editor.set('maxImportedImageSize', undefined);
editor.startup(...);