## SIAddImageClip

### Introduced

v1.0

### Description

Creates and adds a new image clip to the Clips container from an image source. To perform this command you need an image source in the Sources container. You can create an image with the AddImageSource command. This command is similar in syntax and behavior to the AddImageClip command, except that it returns a value through a parameter, instead of from the function directly.
Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:
For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.
For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

### Scripting Syntax

    SIAddImageClip( Source, [Name], [Clip] );

### Parameters

Parameter | Type | Description
--- | --- | ---
Source | String | Source to use to create the clip.
Name | String | The name to use for the new clip.
Clip | ImageClip | Returns the new clip

### Examples

#### 1. VBScript Example

    '

    ' This example shows how to add an image clip from an image source.

    '

    option explicit

    ' First, add an image source.

    Dim oSourceObj, ImageFile

    ImageFile = XSIUtils.BuildPath( _

    	Application.InstallationPath( siProjectPath ), _

    	"Pictures", "xsilogo.jpg" _

    )

    SIAddImageSource ImageFile, "XSIlogo", oSourceObj

    ' Now create an image clip from the image source.

    Dim oClipObj

    SIAddImageClip oSourceObj, "XSIlogo_Clip", oClipObj

    ' Now output some information about the clip, and its source.

    Dim SourceName, SourceFile, XRes, YRes

    SourceName = GetValue( oClipObj & ".Source.Name" )

    Application.LogMessage oClipObj & " Source       : " & CStr(SourceName)

    SourceFile = GetValue( oClipObj & ".SourceFileName" )

    Application.LogMessage oClipObj & " Source File  : " & CStr(SourceFile)

    XRes = GetValue( "Sources." & SourceName & ".XRes" )

    Application.LogMessage oClipObj & " X Resolution : " & CInt(XRes)

    YRes = GetValue( "Sources." & SourceName & ".YRes" )

    Application.LogMessage oClipObj & " Y Resolution : " & CInt(YRes)

    ' Expected results:

    'INFO : "Clips.XSIlogo_Clip Source       : XSIlogo"

    'INFO : "Clips.XSIlogo_Clip Source File  : <ProjectPath>\Pictures\xsilogo.jpg"

    'INFO : "Clips.XSIlogo_Clip X Resolution : 500"

    'INFO : "Clips.XSIlogo_Clip Y Resolution : 513"

#### 2. VBScript Example

    '

    ' This example demonstrates how to create an image source. The user

    ' will be prompted to select an image source.  Select the directory

    ' <$XSI_HOME\Data\XSI_SAMPLES\Pictures\sprites>, and select

    ' the sequence <seq.[0..9;1].tga>.  Then, click OK.

    '

    NewScene , false

    dim oSrc

    set oSrc = AddImageSource( , "SourceImageExample" )

    ' Create and add a image clip, using the previous image source

    SIAddImageClip oSrc, "ImgClipExample"

### See Also

AddImageClip CreateImageClip AddImageSource SIAddImageSource