The Image class enables writing bitmaps to file. More...
The PRIMER 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:
Detailed DescriptionThe Image class enables you to write BMP, GIF, JPEG or PNG images from PRIMER. See the documentation below for more details. |
Filename you want to write. The file will be overwritten if it already exists.
The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If omitted screen resolution will be used
BMP images can be written using either 8 bit (256 colours) or 24 bit (16 million colours). If this is true then an 8 bit image will be written. If false (or omitted) a 24 bit image will be written.
For 8 bit images (see '8bit' argument) the palette can be optimised (Image.OPTIMISE) and/or dithered (Image.DITHER) and/or compressed (Image.COMPRESS) If 0 (or omitted) no palette optimising, dithering or compression will be done.
ReturnsNo return value |
ExampleTo create a 24 bit png file "/data/test/image.png" at 2x screen resolution Image.WriteBMP("/data/test/image.bmp", Image.X2);
|
WriteGIF(filename[string], resolution (optional)[constant], palette (optional)[constant]) [static]DescriptionCreate a gif image of the current screen image |
Filename you want to write. The file will be overwritten if it already exists.
The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If omitted screen resolution will be used
The palette can be optimised (Image.OPTIMISE) and/or dithered (Image.DITHER). If 0 (or omitted) no palette optimising or dithering will be done.
ReturnsNo return value |
ExampleTo create a gif file "/data/test/image.gif" at 2x screen resolution Image.WriteGIF("/data/test/image.gif", Image.X2);
|
WriteJPEG(filename[string], resolution (optional)[constant], quality (optional)[integer]) [static]DescriptionCreate a jpeg image of the current screen image |
Filename you want to write. The file will be overwritten if it already exists.
The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If omitted screen resolution will be used
Quality of the image in percent. Can be in the range [10,100]. If omitted, the quality is 90.
ReturnsNo return value |
ExampleTo create a jpeg file "/data/test/image.jpg" at 2x screen resolution Image.WriteJPEG("/data/test/image.jpg", Image.X2);
|
WritePNG(filename[string], resolution (optional)[constant], 8bit (optional)[boolean], palette (optional)[constant]) [static]DescriptionCreate a png image of the current screen image |
Filename you want to write. The file will be overwritten if it already exists.
The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If omitted screen resolution will be used
PNG images can be written using either 8 bit (256 colours) or 24 bit (16 million colours). If this is true then an 8 bit image will be written. If false (or omitted) a 24 bit image will be written.
For 8 bit images (see '8bit' argument) the palette can be optimised (Image.OPTIMISE) and/or dithered (Image.DITHER). If 0 (or omitted) no palette optimising or dithering will be done.
ReturnsNo return value |
ExampleTo create a 24 bit png file "/data/test/image.png" at 2x screen resolution Image.WritePNG("/data/test/image.png", Image.X2);
|