Oasys.PRIMER.Image class

Constants

Image.COMPRESS

If compression is done for 8 bit bmp images

Image.DITHER

If dithering is done for 8 bit images

Image.OPTIMISE

If palette optimisation is done for 8 bit images

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

Static methods

classmethod Image.WriteBMP(filename, resolution=Oasys.gRPC.defaultArg, _8bit=Oasys.gRPC.defaultArg, options=Oasys.gRPC.defaultArg)

Create a bmp image of the current screen image

Parameters:
  • filename (string) – Filename you want to write. The file will be overwritten if it already exists

  • resolution (constant) – Optional. The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If omitted screen resolution will be used

  • _8bit (boolean) – Optional. 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

  • options (constant) – Optional. 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

Returns:

No return value

Return type:

None

Example

To create a 24 bit png file “/data/test/image.png” at 2x screen resolution

Oasys.PRIMER.Image.WriteBMP("/data/test/image.bmp", Image.X2)
classmethod Image.WriteGIF(filename, resolution=Oasys.gRPC.defaultArg, palette=Oasys.gRPC.defaultArg)

Create a gif image of the current screen image

Parameters:
  • filename (string) – Filename you want to write. The file will be overwritten if it already exists

  • resolution (constant) – Optional. The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If omitted screen resolution will be used

  • palette (constant) – Optional. The palette can be optimised (Image.OPTIMISE) and/or dithered (Image.DITHER). If 0 (or omitted) no palette optimising or dithering will be done

Returns:

No return value

Return type:

None

Example

To create a gif file “/data/test/image.gif” at 2x screen resolution

Oasys.PRIMER.Image.WriteGIF("/data/test/image.gif", Image.X2)
classmethod Image.WriteJPEG(filename, resolution=Oasys.gRPC.defaultArg, quality=Oasys.gRPC.defaultArg)

Create a jpeg image of the current screen image

Parameters:
  • filename (string) – Filename you want to write. The file will be overwritten if it already exists

  • resolution (constant) – Optional. The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If omitted screen resolution will be used

  • quality (integer) – Optional. Quality of the image in percent. Can be in the range [10,100]. If omitted, the quality is 90

Returns:

No return value

Return type:

None

Example

To create a jpeg file “/data/test/image.jpg” at 2x screen resolution

Oasys.PRIMER.Image.WriteJPEG("/data/test/image.jpg", Image.X2)
classmethod Image.WritePNG(filename, resolution=Oasys.gRPC.defaultArg, _8bit=Oasys.gRPC.defaultArg, palette=Oasys.gRPC.defaultArg)

Create a png image of the current screen image

Parameters:
  • filename (string) – Filename you want to write. The file will be overwritten if it already exists

  • resolution (constant) – Optional. The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If omitted screen resolution will be used

  • _8bit (boolean) – Optional. 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

  • palette (constant) – Optional. 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

Returns:

No return value

Return type:

None

Example

To create a 24 bit png file “/data/test/image.png” at 2x screen resolution

Oasys.PRIMER.Image.WritePNG("/data/test/image.png", Image.X2)