Picture
A Picture attribute, variable or expression can be any valid image. In general, this includes any picture that can be put on the pasteboard or read from a file.
QodlyScript uses native APIs to encode (write) and decode (read) picture. These implementations provide access to numerous native formats.
QodlyScript supports metadata in pictures. Two commands, setPictureMetadata
and getPictureMetadata
, let you benefit from metadata in your developments.
Picture Codec IDs
QodlyScript supports natively a set of picture formats. A picture format is defined through a codecID. Several picture management commands can receive a codecID as a parameter.
The following codec IDs are supported:
- .jpg
- .png
- .bmp
- .gif
- .tif
.svg and .pdf are supported in picture attributes or variables but cannot be processed by picture management commands or operators.
Picture operators
Operation | Syntax | Returns | Action |
---|---|---|---|
Horizontal concatenation | Pict1 + Pict2 | Picture | Add Pict2 to the right of Pict1 |
Vertical concatenation | Pict1 / Pict2 | Picture | Add Pict2 to the bottom of Pict1 |
Horizontal move | Picture + Number | Picture | Move Picture horizontally Number pixels |
Vertical move | Picture / Number | Picture | Move Picture vertically Number pixels |
Resizing | Picture * Number | Picture | Resize Picture by Number ratio |
Horizontal scaling | Picture *+ Number | Picture | Resize Picture horizontally by Number ratio |
Vertical scaling | Picture *| Number | Picture | Resize Picture vertically by Number ratio |
Contains keyword | Picture % String | Boolean | If the keyword "Mer" is associated with the picture stored in PictureExpr (attribute or variable), then PictureExpr % "Mer" is true |
- In order to use the
|
operator, Pict1 and Pict2 must have exactly the same dimension. If both pictures are a different size, the operation Pict1 | Pict2 produces a blank picture. - The
combinePictures
command can be used to superimpose pictures while keeping the characteristics of each source picture in the resulting picture. - Additional operations can be performed on pictures using the
transformPicture
command. - There is no comparison operators on pictures, however QodlyScript proposes the
equalPictures
command to compare two pictures.
Examples
Horizontal concatenation
circle+rectangle //Place the rectangle to the right of the circle
rectangle+circle //Place the circle to the right of the rectangle
Vertical concatenation
circle/rectangle //Place the rectangle under the circle
rectangle/circle //Place the circle under the rectangle
Exclusive superimposition
Pict3 = Pict1 & Pict2 // Superimposes Pict2 on top of Pict1
Inclusive superimposition
Pict3 = Pict1|Pict2 // Recovers resulting mask from superimposing two pictures of the same size
Horizontal move
rectangle+50 //Move the rectangle 50 pixels to the right
rectangle-50 //Move the rectangle 50 pixels to the left
Vertical move
rectangle/50 //Move the rectangle down by 50 pixels
rectangle/-20 //Move the rectangle up by 20 pixels
Resize
rectangle*1.5 //The rectangle becomes 50% bigger
rectangle*0.5 //The rectangle becomes 50% smaller
Horizontal scaling
circle*+3 //The circle becomes 3 times wider
circle*+0.25 //The circle's width becomes a quarter of what it was
Vertical scaling
circle*|2 //The circle becomes twice as tall
circle*|0.25 //The circle's height becomes a quarter of what it was