dxGetTexturePixels | Multi Theft Auto: Wiki Skip to content

dxGetTexturePixels

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function fetches the pixels from a texture element. It can be used with a standard texture, render target or screen source.

Note

This function is slow and not something you want to be doing once a frame. It is slower when reading pixels from a render target or screen source. And is very slow indeed if the texture format is not 'argb' (unless the native ' dds' format is used with correct options).

Important

If the user has not enabled screen uploading in the settings, the function will use a 32x32 empty texture as a basis.

OOP Syntax Help! I don't understand this!

Syntax

string dxGetTexturePixels ( element texture, [ int surfaceIndex = 0, string pixelsFormat = "plain" [, string textureFormat = "unknown"] [, bool mipmaps = true], int x = 0, int y = 0, int width = 0, int height = 0 ] )
Required Arguments
  • texture: MISSING_PARAM_DESC
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • surfaceIndex (default: 0): Desired slice to get if the texture is a volume texture, or desired face to get if the texture is a cube map. (Cube map faces: 0=+X 1=-X 2=+Y 3=-Y 4=+Z 5=-Z)
  • pixelsFormat (default: "plain" [, string textureFormat = "unknown"] [, bool mipmaps = true]): MISSING_PARAM_DESC
  • x (default: 0): MISSING_PARAM_DESC
  • y (default: 0): MISSING_PARAM_DESC
  • width (default: 0): MISSING_PARAM_DESC
  • height (default: 0): MISSING_PARAM_DESC

Returns

  • string: value

Returns pixels string if successful, false if invalid arguments were passed to the function.

Code Examples

shared
local mtaLogo = dxCreateTexture("mta-logo.png")
outputChatBox("MTA logo pixels is: "..dxGetTexturePixels(mtaLogo))