Media_TScale ( xScale ; yScale )
Media_TScale allows you to change the size of an image to a fractional scale of the original.
Parameter | Description |
---|---|
xScale | The horizontal scale. |
yScale | The vertical scale. |
This function is similar to Media_TResize, but instead of specifying target dimensions in pixels, you indicate a scale value of the original. A value of “1” is full sized. You can define fractional scale values, such as “.5” to get half scale.
Reflecting Images
You can use Media_TScale to reflect images around the x or y axes by using negative values. For example, Media_TScale ( -1 ; 1 ) will reflect the image across the horizontal axis, turning the image upside down. Media_TScale ( 1 ; -1 ) will reverse the image left to right.
Activated by Media_TApply.
Returns
Empty string.
Examples
To scale an image to 50 percent of its original size:
Set Field [ MyTable::Response ; Media_TClear ]
Set Field [ MyTable::Response;
Media_TScale ( .5 ; .5 ) ]
Set Field [ MyTable::Picture Result;
Media_TApply ( MyTable::Picture 1 ) ]
To squeeze the width in half while keeping the height the same:
Set Field [ MyTable::Response ; Media_TClear ]
Set Field [ MyTable::Response;
Media_TScale ( 1 ; .5 ) ]
Set Field [ MyTable::Picture Result;
Media_TApply ( MyTable::Picture 1 ) ]
To flip an image upside down:
Set Field [ MyTable::Response ; Media_TClear ]
Set Field [ MyTable::Response;
Media_TScale ( -1 ; 1 ) ]
Set Field [ MyTable::Picture Result;
Media_TApply ( MyTable::Picture 1 ) ]
To scale an image based on the values in two fields named “Scale X” and “Scale Y”:
Set Field [ MyTable::Response ; Media_TClear ]
Set Field [ MyTable::Response;
Media_TScale ( MyTable::Scale X ;
MyTable::Scale Y ) ]Set Field [ MyTable::Picture Result;
Media_TApply ( MyTable::Picture 1 ) ]