Properties specific to Image variables Accessing the pixels Managing the Alpha channel Image variable and Image control Image variable and debugger Creating an image with a specific size Available EXIF tags Functions that use Image variables Functions (prefix syntax) that handle Image variables
Image (Variable type)
In french: Image
The
Image type is used to define the advanced characteristics of an image. You can define and change the characteristics of this image using different WLanguage properties.
Note : For more details on the declaration of this type of variable and the use of WLanguage properties, see
Declaring a variable .
MonImage is Image
MonImage . Width = 500
MonImage . Height = 100
MonImage = dLoadImage ( "image.png" )
dStartDrawing ( MonImage )
dFont ( "Arial" , 12 , iNormal , 0 )
dText ( 4 , 0 , "J'écris mon texte dans un champ Image !" )
dResize ( MonImage , 100 , 100 )
dEndDrawing ( MonImage )
IMG_ChampImage = MonImage
Properties
Properties specific to Image variables
The following properties can be used to define the characteristics of Image variables:
Property name Type used Effect BitPerPixel Integer Number of bits per pixel. This property is read-only .
DrawingScale Real Scale to be used for drawing functions (dXXX functions): the coordinates used by these functions will be multiplied by this value. EXIF[Exif tag] Associative array Allows you to get and change the content of the specified Exif tag. Modified Exif tags can be saved using dSaveImageJPEG with the imgSaveTag constant. The Empty property is used to determine if the content of the Exif tag is empty. For example:
MonImage is Image
...
IF NOT MonImage . EXIF [ 320 ] . . Empty THEN
lsTagValeur = MonImage . EXIF [ 320 ]
END
The available Exif tags are listed in the
Remarks .
FillColor Color variableFill color of the image. This color is used: when the image is resized (Height and Width properties). when turning the image around (dRotation ). Height Integer Image height in pixels. If this property is modified, the image is not distorted: additional pixels are added. The color of these pixels is defined with the FillColor property.
Image All types Used to load an image from a buffer, a file or a memo. This property is equivalent to the dLoadImage function. Remarks:
In read mode, this property returns a buffer containing the image in PNG format. The images in SVG or PDF format are not supported. To manage these formats, you must use dLoadImage . The animated images are not supported. A single page of multi-page images (TIF, ICO) can be loaded. Only the first page is loaded. You have the ability to draw a chart in an Image variable via grDestinationImage . Pixel[x,y] Array of Color Used to handle the pixels of the image. Valid Boolean Returns the validity of the image: True if the image is valid: it has been correctly loaded or created.False otherwise. This property is read-only . Width Integer Image width in pixels. If this property is modified, the image is not distorted: additional pixels are added. The color of these pixels is defined with the FillColor property.
WithAlpha Boolean Determines whether the image contains an alpha channel: True if the image contains an alpha channel, False otherwise. This property is read-only .
Remarks
Accessing the pixels
To access the pixels of the image, you have the ability to use the following syntax:
<Name of Image Variable>[<Horizontal coordinate>, <Vertical coordinate>]
The origin of the coordinates is (0,0).
For example:
MonImage [ 220 , 300 ] = LightYellow
You also have the ability to use the
Color properties. For example:
MonImage [ 220 , 300 ] . Luminosité = MonImage [ 220 , 300 ] . Luminosité + 10
Managing the Alpha channel
An image contains an Alpha channel in the following cases:
if it was created by default with an alpha channel, specified with the FillColor property. if it was loaded from an image format containing an alpha channel (PNG format for example). You can also handle the Alpha channel of the image by handling its pixels.
Image variable and Image control
It is possible to:
assign an Image variable to an Image control. assign an Image control to an Image variable. These operations are available for the Image controls found in the window editor, page editor and report editor.
Image variable and debugger
The content of an Image variable can be viewed in the debugger.
Creating an image with a specific size
To create an image with a specific size, all you have to do is use
Width and
Height .
For example:
MonImage is Image
MonImage . Width = 10
MonImage . Height = 10
The unit used is the pixel.
The following code creates an image of 0 x 0.
Available EXIF tags
The table below lists the Exif tag values and the corresponding constants:
Tag WLanguage constant Value 37510 imgComment Character string Comments about the image 37122 imgCompression Real Compression of the image in bits/pixel 33432 imgCopyright Character string Copyright of the image 306 imgDate Date Date and time of the image in YYYY:MM:DD HH:MM:SS format 270 imgDescription Character string Image description 37382 imgSubjectDistance Real Distance from the subject in meters 37380 imgExposureBias Real Exposure bias in APEX 37385 imgFlash Integer Status of the flash during the shot:0: Flash not fired. 1: Flash off. 5: Flash triggered and return light not detected. 7: Flash triggered and return light detected. 928 imgHeight Integer Image height in pixels 672 imgWidth Integer Image width in pixels 305 imgRecordingSoftware Character string Name of the software that was used to record the image. 37386 imgFocalLength Real Focal length in millimeters 37379 imgBrightness Real Brightness of the image in APEX 271 imgDeviceMark Character string Mark of the camera that took the photo 272 imgDeviceModel Character string Model of camera that took the photo 37383 imgMeteringMode Integer Metering mode:0: unknown. 1: average. 2: centered average. 3: point. 4: multipoint. 5: motif. 6: partial. 7 to 254: reserved. 255: other. 37500 imgManufacturerNote Character string Name of the camera manufacturer 274 imgOrientation Integer Orientation of the image: This information indicates the location of the point (0,0) in the image. To display the image in the correct direction based on this information, use the following values:1: the point (0,0) is at the top left of the transformed image, so there's nothing to do. 2: the point (0,0) is at the top right of the transformed image, so we need to perform vertical symmetry. 3: the point (0,0) is at bottom right in the transformed image, so we need to perform horizontal and vertical symmetry. 4: the point (0,0) is at bottom left in the transformed image, so we need to perform horizontal symmetry. 5: the point (0,0) is on the left and at the top of the transformed image, so we need to perform a horizontal symmetry and a 90° rotation. 6: the point (0,0) is on the right and at the top of the transformed image, so a 90° rotation is required. 7: the point (0,0) is on the right and at the bottom of the transformed image, so we need to perform a vertical symmetry and a 90° rotation. 8: the point (0,0) is on the left and at the bottom of the transformed image, so we need to rotate it by -90°. 37378 imgAperture Real Aperture in APEX 33437 imgFAperture Real Focal 37381 imgMaxAperture Real Maximum aperture in APEX 34850 imgExposureProgram Integer Exposure mode used during the shot:0: undefined. 1: manual. 2: normal. 3: aperture priority. 4: speed priority. 5: creative. 6: action. 7: close-up portrait without background. 8: landscape. 9 to 255: other. 282 imgXResolution Real Horizontal resolution of the image 283 imgYResolution Real Vertical resolution of the image 37384 imgLightSource Integer Light source for the image:0: unknown. 1: daylight. 2: fluorescent. 3: tungsten. 17: standard light A. 18: standard light B. 19: standard light C. 20: D55. 21: D65. 22: D75. 23 to 254: reserved. 255: other. 33434 imgExposureTime Real Exposure time 296 imgResolutionUnit Integer Unit for the horizontal and vertical resolution of the image: 2: inches. 3: centimetres. 36864 imgEXIFVersion Character string Version of Exif information 65536 imgThumbnail Binary string Thumbnail corresponding to the image 37377 imgShutterSpeed Real Shutter speed in APEX
Other tags are also available. These unlisted tags are specific to some types of cameras or correspond to custom tags.
Functions that use Image variables
AlbumSave Saves an image, a photo or a video in the photo album of the mobile device. BCToImage Generates the image of a bar code. Clipboard Retrieves the text or image found in the system clipboard. dAlphaBlend Blends two images together. This allows you to create fade-in effects between 2 images. dArc Draws an arc of circle or an arc of ellipse: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dBackground Declares the default background color for the rectangles, circles, etc:: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dBlur Blurs the entire given area: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dBorder Draws the borders. dChangeMode Changes the drawing mode used by the drawing functions (dLine , dRectangle , ....). dChord Draws the chord of a circle (intersection between an ellipse and a straight line): in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dCircle Draws a circle or an ellipse: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dCopy Copies an image to another image. dCopyControlImage Copies the image of a control in a WINDEV window to a variable of type Image . dCopyImage Copies an image: from an Image control to another Image control. from an Image variable to another Image variable. dCopyScreenImage Copies the screen contents to an Image variable or to an Image control. dCopyWindowImage Copies the image from a WINDEV window to an Image variable or to an Image control. dCrop Returns the cropped part of an image. This image is in an Image variable. Compares two images and returns a grayscale image and a percentage determining the differences between the images.This new function is available from WINDEV Suite SaaS 2025 - Update 3.
dDominantImageColor Returns the dominant (i.e. most frequent) color of an image in an Image variable or in an Image control. dEncrustColor Encrusts a color in an image found in an Image variable. dEndDrawing Deletes all the drawings made since the last call to dStartDrawing . dFill Colors an area: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dFont Declares the font to be used by the dText function: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dHalo Adds a halo effect on an image found in an Image variable. dHorizontalSymmetry Flips an image with respect to a horizontal axis (symmetry with respect to a horizontal axis). DiagramToImage Exports a diagram to a variable of type Image . dInvertColor Reverses the colors: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dLine Draws a line: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dLoadImage Loads an image in an Image variable from a memo, a file or a binary buffer. dModifyHSL Modifies the hue, the saturation and the lightness of an image found: in an Image control, in an Image variable. dModifyHue Modifies the hue of an image found: in an Image control, in an Image variable. dModifyLightness Changes the lightness of an image found: in an Image control, in an Image variable. dModifyOpacity Modifies the opacity of an image (which means the alpha channel of the image). dModifySaturation Modifies the saturation of an image found: in an Image control, in an Image variable. DocAdd Adds: at the end of a word processing document: an element, document, paragraph, text, image or fragment. at the end of a fragment: an element, text or image. DocInsert Inserts an object into a Word Processing document or replaces the content of the current fragment. The objects that can be used are: an element, a document, a paragraph, a text, an image, a fragment. DocToImage Exports a page found in a Word Processing document in image format. dPen Declares the default color and style for lines, rectangles, circles, etc. contained in: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dPixelColor Identifies the color of a pixel found: dPixelOpacity Identifies the opacity of a pixel in an image that has an Alpha channel. This image can be: an Image control, an Image variable, a WDPic variable (on the background layer), a picLayer variable.
dPoint Draws a point: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dPolygon Draws a polygon: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dPolyline Draws a line composed of multiple segments. dRectangle Draws a rectangle: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dRectangleGradient Draws a rectangle: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dResize Resizes an image found: dRotation Performs a rotation: dRoundedRectangle Draws a rounded rectangle:in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dSaveImageBMP Saves an image:in a file in BMP format. in memory. dSaveImageGIF Saves an image:in a file in GIF format. in memory. dSaveImageJPEG Saves an image:in a JPEG file. in memory. dSaveImagePNG Saves an image:
dShadow Adds a shadow effect on an image found in an Image variable. dSlice Draws a circle section or an ellipse section: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dStartDrawing Indicates that the drawing functions that will be used are intended for: the specified Image control, the specified Image variable, the specified Image variable, the specified WDPic variable (on the background layer), the specified picLayer variable. dText Draws a text: in an Image control, in an Image variable, in a WDPic variable (on the background layer), in a picLayer variable. dTextRTF Draws RTF text:in an Image control, in an Image variable. dTransferToImage Creates an image from a buffer of pixels encoded in a specific format. This function is an advanced function . This function is mainly used to handle the images returned by external APIs via Image variables.
dVerticalSymmetry Flips an image with respect to a vertical axis (symmetry with respect to a vertical axis). grDestinationImage Defines an Image variable as destination of a chart. grSaveImage Saves the image of a chart in an Image variable. iImageHeight Calculates the height of the image to print (in millimeters). iImageWidth Calculates the width of the image to print (in millimeters). iPrintImage Sends the image file to print to the print buffer. PDFExtractPage Extracts a page from a PDF file in a variable of type Image . ToClipboard Writes text or image information into the system clipboard.
Functions (prefix syntax) that handle Image variables
This page is also available for…