PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Properties specific to the description of 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
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The Image type is used to define the advanced characteristics of an image. The characteristics of this image can be defined and changed using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
MyImage is Image
MyImage.Width = 500
MyImage.Height = 100
// Load from a file
MyImage = dLoadImage("image.png")
// Equivalent syntaxes
// MyImage = "image.png"
// MyImage..Image = "image.png"
 
// Draw in the image
dStartDrawing(MyImage)
 
// Write a text
dFont("Arial", 12, iNormal, 0)
dText(4, 0, "I am writing my text in an Image control!")
 
// Resize
dResize(MyImage, 100, 100)
 
// End of drawing
dEndDrawing(MyImage)
 
// Assign to an Image control
IMG_ImageControl = MyImage
Remarks

Properties specific to the description of Image variables

The following properties can be used to handle an Image variable:
Property nameType usedEffect
BitPerPixelIntegerNumber of bits per pixel.
This property is read-only.
DrawingScaleRealScale that will be used for the drawing functions (dXXX functions): the coordinates used by these functions will be multiplied by this value.
Java This property is not available.
EXIF[Exif tag]Associative arrayAllows 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:
MyImage is Image
...
IF NOT MyImage.EXIF[320]..Empty THEN
IsTagValue = MyImage.EXIF[320]
END
The available Exif tags are listed in the Remarks.
iPhone/iPadIOS WidgetMac CatalystJava This property is not available.
FillColorColor variableFill color of the image. This color is used:
  • when the image is resized (Height and Width properties).
  • when turning the image around (dRotation).
HeightIntegerImage height in pixels.
If this property is modified, the image is not deformed: additional pixels are added. The color of these pixels is defined with the FillColor property.
ImageAll typesUsed to load an image from a buffer, a file or a memo. This property is equivalent to dLoadImage.
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.
iPhone/iPadIOS WidgetMac Catalyst The ICO format is not supported by iOS.
Pixel[x,y]Array of ColorUsed to handle the pixels of the image.
ValidBooleanReturns the validity of the image:
  • True if the image is valid: it was successfully loaded or created.
  • False otherwise.
This property is read-only.
WidthIntegerImage width in pixels.
If this property is modified, the image is not deformed: additional pixels are added. The color of these pixels is defined with the FillColor property.
WithAlphaBooleanUsed to find out whether the image contains an alpha channel:
  • True if the image contains an alpha channel,
  • False otherwise.
This property is read-only.

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:
// Modify the pixel at coordinates 220,300
MyImage[220,300] = LightYellow
You also have the ability to use the Color properties. For example:
MyImage[220,300].Lightness = MyImage[220,300].Lightness + 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

You can:
  • 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:
MyImage is Image
MyImage.Width = 10
MyImage.Height = 10
The unit used is the pixel.
The following code creates an image of 0 x 0.
MyImage is Image

Available EXIF tags

The table below lists the Exif tag values and the corresponding constants:
TagWLanguage constantValue
37510imgCommentCharacter string
Comments about the image
37122imgCompressionReal
Compression of the image in bits/pixel
33432imgCopyrightCharacter string
Copyright of the image
306imgDateDate
Date and time of the image in YYYY:MM:DD HH:MM:SS format
270imgDescriptionCharacter string
Image description
37382imgSubjectDistanceReal
Distance from the subject in meters
37380imgExposureBiasReal
Exposure bias in APEX
37385imgFlashInteger
Status of the flash during the shot:
  • 0: Flash off.
  • 1: Flash on.
  • 5: Flash on and light not detected.
  • 7: Flash on and light detected.
928imgHeightInteger
Height of image in pixels
672imgWidthInteger
Width of image in pixels
305imgRecordingSoftwareCharacter string
Name of the software that was used to record the image.
37386imgFocalLengthReal
Focal length in millimeters
37379imgBrightnessReal
Brightness of the image in APEX
271imgDeviceMarkCharacter string
Mark of the camera that took the photo
272imgDeviceModelCharacter string
Model of camera that took the photo
37383imgMeteringModeInteger
Metering mode:
  • 0: unknown.
  • 1: average.
  • 2: average centered.
  • 3: point.
  • 4: multidot.
  • 5: pattern.
  • 6: partial.
  • 7 to 254: reserved.
  • 255: other.
37500imgManufacturerNoteCharacter string
Name of the camera manufacturer
274imgOrientationInteger
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, there is nothing to do.
  • 2: the point (0,0) is at the top right, the image must be flipped horizontally.
  • 3: the point (0,0) is at the bottom right, the image must be flipped horizontally and vertically.
  • 4: the point (0,0) is at the bottom left, the image must be flipped horizontally.
  • 5: the point (0,0) is at the top left, the image must be flipped horizontally and rotated 90°.
  • 6: the point (0,0) is at the top right, the image must be rotated 90°.
  • 7: the point (0,0) is at the bottom left, the image must be flipped vertically and rotated 90°.
  • 8: the point (0,0) is at the bottom right, the image must be rotated -90°.
37378imgApertureReal
Aperture in APEX
33437imgFApertureReal
Focal
37381imgMaxApertureReal
Maximum aperture in APEX
34850imgExposureProgramInteger
Exposure mode used during the shot:
  • 0: undefined.
  • 1: manual.
  • 2: normal.
  • 3: priority to aperture.
  • 4: priority to speed.
  • 5: creation.
  • 6: action.
  • 7: close-up portrait without background.
  • 8: landscape.
  • 9 to 255: others.
282imgXResolutionReal
Horizontal resolution of the image
283imgYResolutionReal
Vertical resolution of the image
37384imgLightSourceInteger
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.
33434imgExposureTimeReal
Exposure time
296imgResolutionUnitInteger
Unit for the horizontal and vertical resolution of the image:
  • 2: inches.
  • 3: centimeters.
36864imgEXIFVersionCharacter string
Version of Exif information
65536imgThumbnailBinary string
Thumbnail corresponding to the image
37377imgShutterSpeedReal
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

AlbumSaveSaves an image, a photo or a video in the photo album of the mobile device.
BCToImageGenerates the image of a bar code.
dArcDraws 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.
dBorderDraws the borders.
dCircleDraws 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.
dChangeModeChanges the drawing mode used by the drawing functions (dLine, dRectangle, ....).
dLoadImageLoads an image in an Image variable from a memo, a file or a binary buffer.
dCopyCopies an image to another image.
dCopyBltCopies an image:
  • from an Image control to another Image control.
  • from an Image variable to another Image variable.
dCopyScreenImageCopies the screen content to an Image variable or to an Image control.
dCopyWindowImageCopies the image from a WINDEV window to an Image variable or to an Image control.
dChordDraws 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.
dDominantImageColorReturns the dominant (i.e. most frequent) color of an image in an Image variable or in an Image control.
dStartDrawingIndicates 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.
dCropReturns the cropped part of an image. This image is found in an Image variable.
dEndDrawingDeletes all the drawings made since the last call to dStartDrawing.
dBlurBlurs the entire given area:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dBackgroundDeclares 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.
dAlphaBlendBlends two images together. This allows you to create fade-in effects between 2 images.
dHaloAdds a halo effect on an image found in an Image variable].
DiagramToImageExports a diagram to a variable of type Image.
dEncrustColorEncrusts a color in an image found in an Image variable].
dInvertColorInverts the colors:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dLineDraws a line:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dModifyLightnessChanges the lightness of an image found:
  • in an Image control,
  • in an Image variable.
dModifyOpacityModifies the opacity of an image (which means the alpha channel of the image).
dModifySaturationModifies the saturation of an image found:
  • in an Image control,
  • in an Image variable.
dModifyHueChanges the hue of an image:
  • in an Image control,
  • in an Image variable.
dModifyHSLModifies the hue, the saturation and the lightness of an image found:
  • in an Image control,
  • in an Image variable.
DocAddAdds:
  • at the end of a Word Processing document: an element, a document, a paragraph, a text, an image or a fragment.
  • at the end of a fragment: an element, a text or an image.
DocInsertInserts 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.
DocToImageExports a page found in a Word Processing document in image format.
dShadowAdds a shadow effect on an image found in an Image variable].
dPixelColorIdentifies the color of a pixel:
dPixelOpacityIdentifies 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.
dPointDraws a point:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dFontDeclares the font that will be used by dText:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dPolygonDraws a polygon:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dPolylineDraws a line composed of multiple segments.
dSliceDraws 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.
dRectangleDraws a rectangle:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dRoundedRectangleDraws a rounded rectangle:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dRectangleGradientDraws a rectangle:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dResizeResizes an image:
  • in an Image control,
  • in an Image variable.
  • in a picLayer variable].
dFillColors an area:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dRotationPerforms a rotation:
  • of an Image control,
  • of an Image variable,
  • of a picLayer variable.
dSaveImageBMPSaves an image:
  • in a file in BMP format.
  • in memory.
dSaveImageGIFSaves an image:
  • in a file in GIF format.
  • in memory.
dSaveImageJPEGSaves an image:
  • in a JPEG file.
  • in memory.
dSaveImagePNGSaves an image:
  • in a PNG file.
  • in memory.
dPenDeclares the default color and style for the lines, rectangles, circles, ... found:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dHorizontalSymmetryFlips an image with respect to a horizontal axis (symmetry with respect to a horizontal axis).
dVerticalSymmetryFlips an image with respect to a vertical axis (symmetry with respect to a vertical axis).
dTextDraws a text:
  • in an Image control,
  • in an Image variable,
  • in a WDPic variable (on the background layer),
  • in a picLayer variable.
dTextRTFDraws RTF text:
  • in an Image control,
  • in an Image variable.
dTransferToImageCreates 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.
grDestinationImageDefines an Image variable as destination of a chart.
grSaveImageSaves the image of a chart in an Image variable.
iImageHeightCalculates the height of the image to print (in millimeters).
iPrintImageSends the image file to print to the print buffer.
iImageWidthCalculates the width of the image to print (in millimeters).
PDFExtractPageReturns an Image type variable containing a page from a PDF file.
ClipboardRetrieves the text or image found in the system clipboard.
ToClipboardWrites text or image information into the system clipboard.

Functions (prefix syntax) that handle Image variables

<Image variable>.DrawArcDraws a circle arc or an ellipse arc in an Image variable.
<Image variable>.DrawBorderDraws the borders in an Image variable.
<Image variable>.DrawCircleDraws a circle or an ellipse in an Image variable.
<Image variable>.ChangeModeChanges the drawing mode used by the drawing functions (dLine, dRectangle, ....).
<Image variable>.CopyCopies an image to another image.
<Image variable>.DrawChordDraws the chord of a circle (intersection between an ellipse and a straight line) in an Image variable.
<Image variable>.DominantImageColorReturns the dominant color (i.e. most frequent color) of an image found in an Image variable.
<Image variable>.StartDrawingIndicates that the drawing functions that will be used are intended for an Image variable.
<Image variable>.CropReturns the cropped part of an image. This image is found in an Image variable.
<Image variable>.BackgroundDeclares the default background color for the rectangles and circles, ... used in an Image variable.
<Image variable>.DrawHaloAdds a halo effect on an image found in an Image variable].
<Image variable>.EncrustColorEncrusts a color in an image found in an Image variable].
<Image variable>.InvertColorInverts the colors in an Image variable.
<Image variable>.DrawLineDraws a line in an Image variable.
<Image variable>.ModifyLightnessModifies the lightness of an image in an Image variable.
<Image variable>.ModifyOpacityModifies the opacity of an image (which means the alpha channel of the image).
<Image variable>.ModifySaturationModifies the saturation of an image in an Image variable.
<Image variable>.ModifyHueChanges the hue of an image in an Image variable.
<Image variable>.ModifyHSLModifies the hue, saturation and lightness of an image in an Image variable.
<Image variable>.DrawShadowAdds a shadow effect on an image found in an Image variable].
<Image variable>.PixelColorIdentifies the color of a pixel contained in an Image variable.
<Image variable>.PixelOpacityIdentifies the opacity of a pixel in an image (in an Image variable) with an Alpha channel.
<Image variable>.DrawPointDraws a point in an Image variable.
<Image variable>.FontDeclares the font that will be used by dText in an Image variable.
<Image variable>.DrawPolygonDraws a polygon in an Image variable.
<Image variable>.DrawPolylineDraws a line composed of multiple segments in an Image variable.
<Image variable>.DrawSliceDraws a section of a circle or an ellipse in an Image variable.
<Image variable>.DrawRoundedRectangleDraws a rounded rectangle in an Image variable.
<Image variable>.DrawRectangleGradientDraws a rectangle in an Image variable.
<Image variable>.DrawRectangleDraws a rectangle in an Image variable.
<Image variable>.ResizeResizes an image in an Image variable.
<Image variable>.FillColors an area in an Image variable.
<Image variable>.RotationRotates an image in an Image variable.
<Image variable>.SaveBMPSaves an image contained in an Image variable:
  • in a file in BMP format.
  • in memory.
<Image variable>.SaveGIFSaves an image found in an Image variable:
  • in a file in GIF format.
  • in memory.
<Image variable>.SaveJPEGSaves an image found in an Image variable:
  • in a JPEG file.
  • in memory.
<Image variable>.SavePNGSaves an image found in an Image variable:
  • in a PNG file.
  • in memory.
<Image variable>.PenDeclares the default color and style for the lines, rectangles, circles, ... in an Image variable.
<Image variable>.HorizontalSymmetryFlips an image contained in an Image variable with respect to a horizontal axis (symmetry with respect to a horizontal axis).
<Image variable>.VerticalSymmetryFlips an image contained in an Image variable with respect to a vertical axis (symmetry with respect to a vertical axis).
<Image variable>.DrawTextRTFDraws an RTF text in an Image variable.
<Image variable>.DrawTextDraws a text in an Image variable.
Minimum version required
  • Version 17
This page is also available for…
Comments
 image clip vidéo
https://youtu.be/A3x_45AOsPE

// image clip vidéo

// recortar imagen
amarildo
06 Jan. 2019