Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Image

Inherits: Resource < RefCounted < Object

Image datatype.

Description

Native image datatype. Contains image data which can be converted to an ImageTexture and provides commonly used image processing methods. The maximum width and height for an Image are MAX_WIDTH and MAX_HEIGHT.

An Image cannot be assigned to a texture property of an object directly (such as Sprite2D.texture), and has to be converted manually to an ImageTexture first.

Note: The maximum image size is 16384×16384 pixels due to graphics hardware limitations. Larger images may fail to import.

Tutorials

Properties

Dictionary

data

{ "data": PackedByteArray(), "format": "Lum8", "height": 0, "mipmaps": false, "width": 0 }

Methods

void

adjust_bcs ( float brightness, float contrast, float saturation )

void

blend_rect ( Image src, Rect2i src_rect, Vector2i dst )

void

blend_rect_mask ( Image src, Image mask, Rect2i src_rect, Vector2i dst )

void

blit_rect ( Image src, Rect2i src_rect, Vector2i dst )

void

blit_rect_mask ( Image src, Image mask, Rect2i src_rect, Vector2i dst )

void

bump_map_to_normal_map ( float bump_scale=1.0 )

void

clear_mipmaps ( )

Error

compress ( CompressMode mode, CompressSource source=0, ASTCFormat astc_format=0 )

Error

compress_from_channels ( CompressMode mode, UsedChannels channels, ASTCFormat astc_format=0 )

Dictionary

compute_image_metrics ( Image compared_image, bool use_luma )

void

convert ( Format format )

void

copy_from ( Image src )

Image

create ( int width, int height, bool use_mipmaps, Format format ) static

Image

create_from_data ( int width, int height, bool use_mipmaps, Format format, PackedByteArray data ) static

void

crop ( int width, int height )

Error

decompress ( )

AlphaMode

detect_alpha ( ) const

UsedChannels

detect_used_channels ( CompressSource source=0 ) const

void

fill ( Color color )

void

fill_rect ( Rect2i rect, Color color )

void

fix_alpha_edges ( )

void