The Image class allows you to write image and movie files from D3PLOT. More...
The D3PLOT JavaScript API provides many class constants, properties and methods. For Arup to
be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase
or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you
should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your
own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:
| Name | Description |
| Image.GLBU | Uncompressed GLB animation file |
| Name | Description |
| Image.GLB | GLB animation file |
| Name | Description |
| Image.AGIF | 8-bit animated GIF file |
| Image.AVI | AVI movie file |
| Image.MP4 | MP4 movie file |
| Name | Description |
| Image.SCREEN | Image will be created at screen resolution. |
| Image.X2 | Image will be created at 2x screen resolution. |
| Image.X4 | Image will be created at 4x screen resolution. |
| Name | Description |
| Image.ALL_STATES | Use all states |
Detailed DescriptionThe Image class gives you methods to be able to write images, animations and 3D models. See the documentation below for more details. |
Details of functionsWrite3D(name[string], options (optional)[object]) [static]DescriptionWrites a 3D (GLB) file |
Filename for the movie
Object containing options for writing movie. Can be any of:
Object has the following properties:
| Name | Type | Description |
| anonymise | boolean | Anonymise part tree (default = false) |
| format | constant | The format for the 3D file. Either Image.GLB (default) or Image.GLBU |
| frameRate | integer | The frame rate if multiple states are written (default = 25) |
| graphicsWindow | GraphicsWindow | An individual GraphicsWindow to write 3D data for. If not given (default) all the windows on the current page will be written |
| state | integer | The state number to write or Image.ALL_STATES (default) |
ReturnsNo return value |
ExampleTo write a 3D file "example.glb" for graphics window gw: Image.Write3D("example.glb", { 'graphicsWindow': gw } );
|
WriteImage(name[string], options (optional)[object]) [static]DescriptionWrites a static image file |
Filename for the image
Object containing options for writing image. Can be any of:
Object has the following properties:
| Name | Type | Description |
| dither | boolean | Whether to dither 8 bit images or not (default is false) |
| format | constant | The format for the image. One of Image.BMP8C, Image.BMP8, Image.BMP, Image.JPEG, Image.PPM, Image.PNG (default), Image.PNG8 or Image.GIF |
| graphicsWindow | GraphicsWindow | An individual GraphicsWindow to write image for. If not given (default) all the windows on the current page will be written |
| optimise | boolean | Whether to optimise the colour palette for 8 bit images or not (default is true) |
| quality | integer | The quality for JPEG images (1 - 100) (default = 90) |
| resolution | constant | The resolution for the image. One of Image.SCREEN (default), Image.X2 or Image.X4 |
ReturnsNo return value |
ExampleTo write an image "example.png" Image.WriteImage("example.png");
|
WriteMovie(name[string], options (optional)[object]) [static]DescriptionWrites a movie file |
Filename for the movie
Object containing options for writing movie. Can be any of:
Object has the following properties:
| Name | Type | Description |
| aviFormat | constant | The AVI format for the movie if writing an AVI file. One of Image.JPEG (default), Image.BMP8C, Image.BMP8 or Image.BMP |
| dither | boolean | Whether to dither 8 bit images or not (default is false) |
| format | constant | The format for the movie. One of Image.MP4 (default), Image.AVI or Image.AGIF |
| frameRate | integer | The frame rate (default = 25) |
| graphicsWindow | GraphicsWindow | An individual GraphicsWindow to write movie for. If not given (default) all the windows on the current page will be written |
| quality | integer | The quality for AVI MJPEG images (1 - 100) (default = 90) |
| repeat | integer | The number of repeats for the movie. 0 is infinite (default = 0) |
| targetFileSize | real | The target file size for the movie file in megabytes. This only applies when 'format' is Image.MP4. If this is positive, it supersedes any value for 'quality'. This value is only a target and not a certainly achieved exact size. If the target file size is 0.0, it has the same effect as being undefined. |
ReturnsNo return value |
ExampleTo write a movie "example.mp4": Image.WriteMovie("example.mp4");
|