Love2D APIImageOn this pageImage Description: Drawable image type. release Type: Function. Description: Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread. This method can be used to immediately clean up resources without waiting for Lua's garbage collector. Signature: release: function(self: Image): boolean Returns: Return TypeDescriptionbooleanTrue if the object was released by this call, false if it had been previously released. type Type: Function. Description: Gets the type of the object as a string. Signature: type: function(self: Image): string Returns: Return TypeDescriptionstringThe type as a string. Of Type: Function. Description: Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true. Signature: typeOf: function(self: Image, type_name: string): boolean Parameters: ParameterTypeDescriptiontype_namestringThe name of the type to check for. Returns: Return TypeDescriptionbooleanTrue if the object is of the specified type, false otherwise. getWidth Type: Function. Description: Gets the width of the Texture. Signature: getWidth: function(self: Image): number Returns: Return TypeDescriptionnumberThe width of the Texture. getHeight Type: Function. Description: Gets the height of the Texture. Signature: getHeight: function(self: Image): number Returns: Return TypeDescriptionnumberThe height of the Texture. getDimensions Type: Function. Description: Gets the width and height of the Texture. Signature: getDimensions: function(self: Image): number, number Returns: Return TypeDescriptionnumberThe width of the Texture.numberThe height of the Texture. getPixelWidth Type: Function. Description: Gets the width in pixels of the Texture. DPI scale factor, rather than pixels. Use getWidth for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelWidth only when dealing specifically with pixels, for example when using Canvas:newImageData. Signature: getPixelWidth: function(self: Image): integer Returns: Return TypeDescriptionintegerThe width of the Texture, in pixels. getPixelHeight Type: Function. Description: Gets the height in pixels of the Texture. DPI scale factor, rather than pixels. Use getHeight for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelHeight only when dealing specifically with pixels, for example when using Canvas:newImageData. Signature: getPixelHeight: function(self: Image): integer Returns: Return TypeDescriptionintegerThe height of the Texture, in pixels. getPixelDimensions Type: Function. Description: Gets the width and height in pixels of the Texture. Texture:getDimensions gets the dimensions of the texture in units scaled by the texture's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelDimensions only when dealing specifically with pixels, for example when using Canvas:newImageData. Signature: getPixelDimensions: function(self: Image): integer, integer Returns: Return TypeDescriptionintegerThe width of the Texture, in pixels.integerThe height of the Texture, in pixels. getDPIScale Type: Function. Description: Gets the DPI scale factor of the Texture. The DPI scale factor represents relative pixel density. A DPI scale factor of 2 means the texture has twice the pixel density in each dimension (4 times as many pixels in the same area) compared to a texture with a DPI scale factor of 1. For example, a texture with pixel dimensions of 100x100 with a DPI scale factor of 2 will be drawn as if it was 50x50. This is useful with high-dpi / retina displays to easily allow swapping out higher or lower pixel density Images and Canvases without needing any extra manual scaling logic. Signature: getDPIScale: function(self: Image): number Returns: Return TypeDescriptionnumberThe DPI scale factor of the Texture. getTextureType Type: Function. Description: Gets the type of the Texture. Signature: getTextureType: function(self: Image): string Returns: Return TypeDescriptionstringThe type of the Texture. getDepth Type: Function. Description: Gets the depth of a Volume Texture. Returns 1 for 2D, Cubemap, and Array textures. Signature: getDepth: function(self: Image): integer Returns: Return TypeDescriptionintegerThe depth of the volume Texture. getLayerCount Type: Function. Description: Gets the number of layers / slices in an Array Texture. Returns 1 for 2D, Cubemap, and Volume textures. Signature: getLayerCount: function(self: Image): integer Returns: Return TypeDescriptionintegerThe number of layers in the Array Texture. getMipmapCount Type: Function. Description: Gets the number of mipmaps contained in the Texture. If the texture was not created with mipmaps, it will return 1. Signature: getMipmapCount: function(self: Image): integer Returns: Return TypeDescriptionintegerThe number of mipmaps in the Texture. getMipmapFilter Type: Function. Description: Gets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images. Signature: getMipmapFilter: function(self: Image): string, number Returns: Return TypeDescriptionstringThe filter mode used in between mipmap levels. nil if mipmap filtering is not enabled.numberValue used to determine whether the image should use more or less detailed mipmap levels than normal when drawing. setMipmapFilter Type: Function. Description: Sets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images. -- Mipmapping is useful when drawing a texture at a reduced scale. It can improve performance and reduce aliasing issues. -- In created with the mipmaps flag enabled for the mipmap filter to have any effect. In versions prior to 0.10.0 it's best to call this method directly after creating the image with love.graphics.newImage, to avoid bugs in certain graphics drivers. -- Due to hardware restrictions and driver bugs, in versions prior to 0.10.0 images that weren't loaded from a CompressedData must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps. Signature: setMipmapFilter: function(self: Image) setMipmapFilter Type: Function. Description: Sets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images. -- Mipmapping is useful when drawing a texture at a reduced scale. It can improve performance and reduce aliasing issues. -- In created with the mipmaps flag enabled for the mipmap filter to have any effect. In versions prior to 0.10.0 it's best to call this method directly after creating the image with love.graphics.newImage, to avoid bugs in certain graphics drivers. -- Due to hardware restrictions and driver bugs, in versions prior to 0.10.0 images that weren't loaded from a CompressedData must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps. Signature: setMipmapFilter: function(self: Image, filter: FilterMode, sharpness?: number) Parameters: ParameterTypeDescriptionfilterFilterModeThe filter mode to use in between mipmap levels. 'nearest' will often give better performance.sharpnessnumberA positive sharpness value makes the texture use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse. (Default: 0.) getFormat Type: Function. Description: Gets the pixel format of the Texture. Signature: getFormat: function(self: Image): string Returns: Return TypeDescriptionstringThe pixel format the Texture was created with. isCompressed Type: Function. Description: Gets whether the Image was created from CompressedData. Compressed images take up less space in VRAM, and drawing a compressed image will generally be more efficient than drawing one created from raw pixel data. Signature: isCompressed: function(self: Image): boolean Returns: Return TypeDescriptionbooleanWhether the Image is stored as a compressed texture on the GPU. isFormatLinear Type: Function. Description: Gets whether the Image was created with the linear (non-gamma corrected) flag set to true. This method always returns false when gamma-correct rendering is not enabled. Signature: isFormatLinear: function(self: Image): boolean Returns: Return TypeDescriptionbooleanWhether the Image's internal pixel format is linear (not gamma corrected), when gamma-correct rendering is enabled. replacePixels Type: Function. Description: Replace the contents of an Image. Signature: replacePixels: function(self: Image, data: any, slice?: integer, mipmap?: integer, x?: integer, y?: integer, reload_mipmaps?: boolean) Parameters: ParameterTypeDescriptiondataanyThe new ImageData to replace the contents with.sliceintegerWhich cubemap face, array index, or volume layer to replace, if applicable. (Default: 1.)mipmapintegerThe mimap level to replace, if the Image has mipmaps. (Default: 1.)xintegerThe x-offset in pixels from the top-left of the image to replace. The given ImageData's width plus this value must not be greater than the pixel width of the Image's specified mipmap level. (Default: 0.)yintegerThe y-offset in pixels from the top-left of the image to replace. The given ImageData's height plus this value must not be greater than the pixel height of the Image's specified mipmap level. (Default: 0.)reload_mipmapsbooleanWhether to generate new mipmaps after replacing the Image's pixels. True by default if the Image was created with automatically generated mipmaps, false by default otherwise. (Default: false.) isReadable Type: Function. Description: Gets whether the Texture can be drawn and sent to a Shader. Canvases created with stencil and/or depth PixelFormats are not readable by default, unless readable=true is specified in the settings table passed into love.graphics.newCanvas. Non-readable Canvases can still be rendered to. Signature: isReadable: function(self: Image): boolean Returns: Return TypeDescriptionbooleanWhether the Texture is readable. getDepthSampleMode Type: Function. Description: Gets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D. Signature: getDepthSampleMode: function(self: Image): string | nil Returns: Return TypeDescriptionstring or nilThe comparison mode used when sampling from this texture in a shader, or nil if setDepthSampleMode has not been called on this Texture. (Default: nil.) setDepthSampleMode Type: Function. Description: Sets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D. When using a depth texture with a comparison mode set in a shader, it must be declared as a sampler2DShadow and used in a GLSL 3 Shader. The result of accessing the texture in the shader will return a float between 0 and 1, proportional to the number of samples (up to 4 samples will be used if bilinear filtering is enabled) that passed the test set by the comparison operation. Depth texture comparison can only be used with readable depth-formatted Canvases. Signature: setDepthSampleMode: function(self: Image, mode?: string) Parameters: ParameterTypeDescriptionmodestringThe comparison mode used when sampling from this texture in a shader. setFilter Type: Function. Description: Sets the filter mode of the Texture. Signature: setFilter: function(self: Image, min_filter: string, mag_filter?: string, anisotropy?: number) Parameters: ParameterTypeDescriptionmin_filterstringFilter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).mag_filterstringFilter mode to use when magnifying the texture (rendering it at a larger size on-screen than its size in pixels). (Default: min.)anisotropynumberMaximum amount of anisotropic filtering to use. (Default: 1.) getFilter Type: Function. Description: Gets the filter mode of the Texture. Signature: getFilter: function(self: Image): string, string, number Returns: Return TypeDescriptionstringFilter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels).stringFilter mode to use when magnifying the texture (rendering it at a smaller size on-screen than its size in pixels).numberMaximum amount of anisotropic filtering used. setWrap Type: Function. Description: Sets the wrapping properties of a Texture. This function sets the way a Texture is repeated when it is drawn with a Quad that is larger than the texture's extent, or when a custom Shader is used which uses texture coordinates outside of [0, 1]. A texture may be clamped or set to repeat in both horizontal and vertical directions. Clamped textures appear only once (with the edges of the texture stretching to fill the extent of the Quad), whereas repeated ones repeat as many times as there is room in the Quad. Signature: setWrap: function(self: Image, horizontal: string, vertical?: string, depth?: string): boolean Parameters: ParameterTypeDescriptionhorizontalstringHorizontal wrapping mode of the texture.verticalstringVertical wrapping mode of the texture. (Default: horiz.)depthstringWrapping mode for the z-axis of a Volume texture. (Default: horiz.) getWrap Type: Function. Description: Gets the wrapping properties of a Texture. This function returns the currently set horizontal and vertical wrapping modes for the texture. Signature: getWrap: function(self: Image): string, string, string Returns: Return TypeDescriptionstringHorizontal wrapping mode of the texture.stringVertical wrapping mode of the texture.stringWrapping mode for the z-axis of a Volume texture.