dxGetPixelsSize | Multi Theft Auto: Wiki Skip to content

dxGetPixelsSize

Client-side
Server-side
Shared

This function gets the dimensions of pixels contained in a string. It works with all pixel formats.

Syntax

int|false, ​int dxGetPixelsSize ( ​string pixels )
Required arguments
  • pixels: The pixels to get the dimensions of.

Returns

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

  • int|false: width
  • int: height

Code Examples

client

The example loads an image, gets its pixels, and outputs the pixels size.

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)