dxConvertPixels
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 converts pixels from one format to another.
Syntax
string dxConvertPixels ( string pixels, string newFormat, [ int quality = 80 ] )Required Arguments
- pixels: MISSING_PARAM_DESC
- newFormat: MISSING_PARAM_DESC
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- quality (default: 80): MISSING_PARAM_DESC
Returns
- string: value
Returns a copy of the pixels in the new format, or false if invalid arguments were passed to the function.
Code Examples
shared
The code opens an image, read its pixels, convert the pixels to PNG, and then save it. (You can usethisimage to test.)
addEventHandler('onClientResourceStart', resourceRoot, function() local img = fileOpen('img.jpg') local pixels = fileRead(img, fileGetSize(img)) local pngPixels = dxConvertPixels(pixels, 'png') local newImg = fileCreate('img.png') fileWrite(newImg, pngPixels) fileClose(newImg) fileClose(img)end)See Also
Drawing Functions
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTarget
- dxCreateScreenSource
- dxCreateShader
- dxCreateTexture
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawModel3D
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsFormat
- dxGetPixelsSize
- dxGetStatus
- dxGetTextSize
- dxGetTexturePixels
- dxGetTextWidth
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetShaderValue
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource