:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the ImageTexture.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_ImageTexture: ImageTexture ============ **Inherits:** :ref:`Texture` **<** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` A :ref:`Texture` based on an :ref:`Image`. Description ----------- A :ref:`Texture` based on an :ref:`Image`. Can be created from an :ref:`Image` with :ref:`create_from_image`. **Note:** The maximum image size is 16384×16384 pixels due to graphics hardware limitations. Larger images will fail to import. Properties ---------- +-------------------------------------------+-----------------------------------------------------------------+---------------------------+ | :ref:`int` | flags | ``7`` *(parent override)* | +-------------------------------------------+-----------------------------------------------------------------+---------------------------+ | :ref:`float` | :ref:`lossy_quality` | ``0.7`` | +-------------------------------------------+-----------------------------------------------------------------+---------------------------+ | :ref:`Storage` | :ref:`storage` | ``0`` | +-------------------------------------------+-----------------------------------------------------------------+---------------------------+ Methods ------- +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`create` **(** :ref:`int` width, :ref:`int` height, :ref:`Format` format, :ref:`int` flags=7 **)** | +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`create_from_image` **(** :ref:`Image` image, :ref:`int` flags=7 **)** | +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Format` | :ref:`get_format` **(** **)** |const| | +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`load` **(** :ref:`String` path **)** | +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_data` **(** :ref:`Image` image **)** | +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_size_override` **(** :ref:`Vector2` size **)** | +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Enumerations ------------ .. _enum_ImageTexture_Storage: .. _class_ImageTexture_constant_STORAGE_RAW: .. _class_ImageTexture_constant_STORAGE_COMPRESS_LOSSY: .. _class_ImageTexture_constant_STORAGE_COMPRESS_LOSSLESS: enum **Storage**: - **STORAGE_RAW** = **0** --- :ref:`Image` data is stored raw and unaltered. - **STORAGE_COMPRESS_LOSSY** = **1** --- :ref:`Image` data is compressed with a lossy algorithm. You can set the storage quality with :ref:`lossy_quality`. - **STORAGE_COMPRESS_LOSSLESS** = **2** --- :ref:`Image` data is compressed with a lossless algorithm. Property Descriptions --------------------- .. _class_ImageTexture_property_lossy_quality: - :ref:`float` **lossy_quality** +-----------+----------------------------------+ | *Default* | ``0.7`` | +-----------+----------------------------------+ | *Setter* | set_lossy_storage_quality(value) | +-----------+----------------------------------+ | *Getter* | get_lossy_storage_quality() | +-----------+----------------------------------+ The storage quality for :ref:`STORAGE_COMPRESS_LOSSY`. ---- .. _class_ImageTexture_property_storage: - :ref:`Storage` **storage** +-----------+--------------------+ | *Default* | ``0`` | +-----------+--------------------+ | *Setter* | set_storage(value) | +-----------+--------------------+ | *Getter* | get_storage() | +-----------+--------------------+ The storage type (raw, lossy, or compressed). Method Descriptions ------------------- .. _class_ImageTexture_method_create: - void **create** **(** :ref:`int` width, :ref:`int` height, :ref:`Format` format, :ref:`int` flags=7 **)** Create a new ``ImageTexture`` with ``width`` and ``height``. ``format`` is a value from :ref:`Format`, ``flags`` is any combination of :ref:`Flags`. ---- .. _class_ImageTexture_method_create_from_image: - void **create_from_image** **(** :ref:`Image` image, :ref:`int` flags=7 **)** Create a new ``ImageTexture`` from an :ref:`Image` with ``flags`` from :ref:`Flags`. An sRGB to linear color space conversion can take place, according to :ref:`Format`. ---- .. _class_ImageTexture_method_get_format: - :ref:`Format` **get_format** **(** **)** |const| Returns the format of the ``ImageTexture``, one of :ref:`Format`. ---- .. _class_ImageTexture_method_load: - :ref:`Error` **load** **(** :ref:`String` path **)** Load an ``ImageTexture`` from a file path. ---- .. _class_ImageTexture_method_set_data: - void **set_data** **(** :ref:`Image` image **)** Sets the :ref:`Image` of this ``ImageTexture``. ---- .. _class_ImageTexture_method_set_size_override: - void **set_size_override** **(** :ref:`Vector2` size **)** Resizes the ``ImageTexture`` to the specified dimensions. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`