PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Copies the RGB pixels of the image into a one-dimensional or two-dimensional array. The array of colors is cleared then it is filled with the integers representing the colors (24 bits) of the image.
Versions 26 and later
WEBDEV - Server codeWindows This function is now available for WEBDEV sites in Windows.
WEBDEV - Server codeLinux This function is now available for WEBDEV sites in Linux.
New in version 26
WEBDEV - Server codeWindows This function is now available for WEBDEV sites in Windows.
WEBDEV - Server codeLinux This function is now available for WEBDEV sites in Linux.
WEBDEV - Server codeWindows This function is now available for WEBDEV sites in Windows.
WEBDEV - Server codeLinux This function is now available for WEBDEV sites in Linux.
Example
arrLightness is array of * by * int
 
dImageToArray("c:\test.png", arrLightness, dComponentRed + dGrayScale)
 
dStartDrawing(IMG_NoName2)
nx, ny are int
FOR nx = 1 _TO_ ArrayInfo(arrLightness, tiNumberRows)
FOR ny = 1 _TO_ ArrayInfo(arrLightness, tiNumberColumns)
dPoint(nx-1, ny-1, arrLightness[nx][ny])
END
END
Syntax

Copying the pixels of an image file into an array Hide the details

dImageToArray(<Image file> , <Array> [, <Options>])
<Image file>: Character string (with quotes)
Path of image file to use.
<Array>: Array variable
Name of the array of 24-bit color into which the pixels will be copied. This array can be a one-dimensional array or a two-dimensional array. For a two-dimensional array, the dimensions represent the X and Y axes of the image.
<Options>: Optional Integer constant (or combination of constants)
Options for calculating the array:
dComponentBlueThe Blue component of image will be copied into the array.
dComponentRedThe Red component of image will be copied into the array.
dComponentRGBAll image components will be copied into the array.
dComponentGreenThe Green component of image will be copied into the array.
dGrayScaleThe image in grayscale will be copied into the array.

Copying the pixels of an image in memory into an array Hide the details

dImageToArray(<Image in memory> , <Array> [, <Options>])
<Image in memory>: Buffer or character string
Byte string containing the image to use. This parameter can for example correspond to an Image stored in memory (functions dSaveImageBMP, dSaveImageGIF, ...).
<Array>: Array variable
Name of the array of 24-bit color into which the pixels will be copied. This array can be a one-dimensional array or a two-dimensional array. For a two-dimensional array, the dimensions represent the X and Y axes of the image.
<Options>: Optional Integer constant (or combination of constants)
Options for calculating the array:
dComponentBlueThe Blue component of image will be copied into the array.
dComponentRedThe Red component of image will be copied into the array.
dComponentRGBAll image components will be copied into the array.
dComponentGreenThe Green component of image will be copied into the array.
dGrayScaleThe image in grayscale will be copied into the array.
Remarks
  • The alpha layer of the image is not returned by this function.
  • Change of behavior in version 23: When converting a PDF file (i.e. a vector image) into an array of pixels, a conversion factor must be applied in order to transform a unit of the PDF into a pixel.
    From version 23 onwards, the conversion factor has been optimized, which results in a reduction in the size of the image in pixels.
    To go back to the behavior of version 22 (non-optimized), you can use the following code (this code uses an Image variable to convert the PDF into the desired dimensions):
    lCMyImageh is string = fCurrentDir() + ["\"] + "myfile.pdf"
    iiMage is Image = dLoadImage(lCMonImageh, imgConvert, 2479, 3504)
    bufImage is Buffer = dSaveImagePNG(iiMage, inMemory)
    lSourcePixelArray is array of * by * integers
    dImageToArray(bufImage, lSourcePixelArray, dComponentRGB + dGrayScale)
    Trace(ArrayInfo(lSourcePixelArray, tiNumberRows) + TAB + ...
    ArrayInfo(lSourcePixelArray, tiNumberColumns))
Business / UI classification: Neutral code
Component: wd260img.dll
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment