# FixImage Documentation

Back to summary

`import "image/image";`

## Image class

Contains the image data. For actual painting use the Painter class.

The pixels are stored in a shared array, you can access the same image from different threads.

### Initialization

`static function create(width: Integer, height: Integer): Image`
  Creates a new image with given dimensions.
`static function load(data: Byte[]): Image`
  Loads a PNG image from given byte array.
`function clone(): Image`
  Returns a copy of this image.
`function get_subimage(x: Integer, y: Integer, width: Integer, height: Integer): Image`
  Returns a rectangular view to this image (the pixels are shared).
`function to_png(): Byte[]`
  Returns the image encoded in a PNG file format.

### Properties

`function get_width(): Integer`
  Returns width of the image.
`function get_height(): Integer`
  Returns height of the image.
`function get_stride(): Integer`
  Returns stride (increments between the rows in pixels array) of the image.
`function get_pixels(): Integer[]`
  Returns shared array with raw pixels.

### Operations

`function downscale(): Image
function downscale(steps: Integer): Image`
  Returns downscaled version (halving the resolution) of the image. Optionally you can pass how many steps you want to apply.
`function blur(radius: Float)`
  Applies fast Gaussian blur approximation. The performance is independent of the radius value.
`function blur_box(radius: Float)
function blur_box(rx: Float, ry: Float, steps: Integer)`
  Applies box blur. The performance is independent of the radius value.
`function blur_gaussian(radius: Float)`
  Applies more accurate Gaussian blur approximation. The performance is independent of the radius value.
`function remap_color_ramps(table: Byte[])`
  Applies color remapping for each channel. The table must have either 256 entries (to apply the same to all color channels) or 768 entries (to apply to each color channel independently).
`function apply_gamma(value: Float)`
  Applies gamma correction to the image.