Description
A Size
object contains the width and height of a Picture
object and is returned by the Picture.Size
property. You can also create an empty Size
object using the Utils.Size
method.
Members
Remarks
If you change the image size via the Picture.Size
property, the image will be resized without scaling. The resulting image will be cropped or padded at the bottom right.
To resize an image with scaling, use the Picture.Stretch
method.
Example
The following example demonstrates how to create an empty Size
object.
JavaScript, JScript
function CreateEmptySize()
{
var Size, SetHeight, SetWidth;
…
// Creates a new Size object
Size = Utils.Size;
// Sets the width and height
Size.Height = SetHeight;
Size.Width = SetWidth;
…
}
Python
def CreateEmptySize():
# ...
# Creates a new Size object
Size = Utils.Size
# Sets the width and height
Size.Height = SetHeight
Size.Width = SetWidth
# ...
VBScript
Sub CreateEmptySize
Dim Size
…
' Creates a new Size object
Set Size = Utils.Size
' Sets the width and height
Size.Height = SetHeight
Size.Width = SetWidth
…
End Sub
DelphiScript
procedure CreateEmptySize();
var Size, SetHeight, SetWidth;
begin
…
// Creates a new Size object
Size := Utils.Size;
// Sets the width and height
Size.Height := SetHeight;
Size.Width := SetWidth;
…
end;
C++Script, C#Script
function CreateEmptySize()
{
var Size, SetHeight, SetWidth;
…
// Creates a new Size object
Size = Utils["Size"];
// Sets the width and height
Size["Height"] = SetHeight;
Size["Width"] = SetWidth;
…
}
The following example demonstrates how to obtain a Size
object that contains the weight and height of the specified picture.
JavaScript, JScript
function ObtainSize()
{
var Pict, Size, x, y;
// Creates a new empty Picture object
Pict = Utils.Picture;
// Loads the image from a file
Pict.LoadFromFile("D:\\Work Folder\\my_image.png");
// Obtains the size of the picture
Size = Pict.Size;
// Obtains the width of the picture
x = Pict.Size.Width;
// Obtains the height of the picture
y = Pict.Size.Height;
// ...
}
Python
def ObtainSize():
# Creates a new empty Picture object
Pict = Utils.Picture
# Loads the image from a file
Pict.LoadFromFile("D:\\Work Folder\\my_image.png")
# Obtains the size of the picture
Size = Pict.Size
# Obtains the width of the picture
x = Pict.Size.Width
# Obtains the height of the picture
y = Pict.Size.Height
# ...
VBScript
Sub ObtainSize
Dim Pict, Size, x, y
' Creates a new empty Picture object
Set Pict = Utils.Picture
' Loads the image from a file
Call Pict.LoadFromFile("D:\Work Folder\my_image.png")
' Obtains the size of the picture
Set Size = Pict.Size
' Obtains the width of the picture
x = Pict.Size.Width
' Obtains the height of the picture
y = Pict.Size.Height
' ...
End Sub
DelphiScript
procedure ObtainSize();
var Pict, Size, x, y;
begin
// Creates a new empty Picture object
Pict := Utils.Picture;
// Loads the image from a file
Pict.LoadFromFile('D:\Work Folder\my_image.png');
// Obtains the size of the picture
Size := Pict.Size;
// Obtains the width of the picture
x := Pict.Size.Width;
// Obtains the height of the picture
y := Pict.Size.Height;
// ...
end;
C++Script, C#Script
function ObtainSize()
{
var Pict, Size, x, y;
// Creates a new empty Picture object
Pict = Utils["Picture"];
// Loads the image from a file
Pict["LoadFromFile"]("D:\\Work Folder\\my_image.png");
// Obtains the size of the picture
Size = Pict["Size"];
// Obtains the width of the picture
x = Pict["Size"]["Width"];
// Obtains the height of the picture
y = Pict["Size"]["Height"];
// ...
}