dxGetPixelsSize | Multi Theft Auto: Wiki Skip to content

dxGetPixelsSize

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 gets the dimensions of pixels contained in a string. It works with all pixel formats.

Syntax

int,​ int dxGetPixelsSize ( string pixels )
Required Arguments
  • pixels: The pixels to get the dimensions of

Returns

  • int: value1
  • int: value2

Returns width and height of the pixels if successful, false if invalid arguments were passed to the function.

Code Examples

shared

The example loads an image, gets its pixels, and outputs the pixels size. (You can usethisimage to test.)

addEventHandler('onClientResourceStart', resourceRoot, function()
local img = fileOpen('img.jpg')
local pixels = fileRead(img, fileGetSize(img))
local size = dxGetPixelsSize(pixels)
outputChatBox('Pixels size is: ' .. size)
fileClose(img)
end)