## AddImageSource

### Introduced

v1.0

### Description

Creates and adds a new image source in the Sources container. To execute this command you must have an image source file on disk. Image sources are used by ImageClip objects in order to perform image composting effects, such as texturing.
This command is similar in syntax and behavior to the SIAddImageClip command, except that it returns a value from the function directly, instead of through a parameter.
It is accessed from the main menu under Render-

### Scripting Syntax

    oReturn = AddImageSource( [FileName], [Name] );

### Return Value

Returns the new image source (a Source object).

### Parameters

Parameter | Type | Description
--- | --- | ---
FileName | String | Full path of the new image source. Default Value: User is prompted to select a file
Name | String | The name to use for the new source.

### Examples

#### VBScript Example

    '---------------------------------------------------------
    ' VBScript example : Adding image sources. This script
    ' demonstrates the use of SIAddImageSource to add image sources
    ' to the scene.
    '---------------------------------------------------------
    ' Get the filenames of some image sources.
    Dim Source1, Source2, Source3
    Source1 = Application.InstallationPath( siFactoryPath ) & "\Data\XSI_SAMPLES\Pictures\xsilogo.jpg"
    Source2 = Application.InstallationPath( siFactoryPath ) & "\Data\XSI_SAMPLES\Pictures\top_teeth.jpg"
    Source3 = Application.InstallationPath( siFactoryPath ) & "\Data\XSI_SAMPLES\Pictures\jio.jpg"
    ' Now create image sources from the filenames.
    Dim XSIsrc, Teethsrc, Jiosrc
    set XSIsrc = AddImageSource(Source1, "XSI")
    set Teethsrc = AddImageSource(Source2, "Teeth")
    set Jiosrc = AddImageSource(Source3, "Jio")
    logmessage XSIsrc & " created with source file : " & Source1
    logmessage Teethsrc & " created with source file : " & Source2
    logmessage Jiosrc & " created with source file : " & Source3
    '---------------------------------------------------------
    ' Output from this script:
    'INFO : "Sources.XSI created with source file : <FactoryPath>\Data\XSI_SAMPLES\Pictures\xsilogo.jpg"
    'INFO : "Sources.Teeth created with source file : <FactoryPath>\Data\XSI_SAMPLES\Pictures\top_teeth.jpg"
    'INFO : "Sources.Jio created with source file : <FactoryPath>\Data\XSI_SAMPLES\Pictures\jio.jpg"
    '---------------------------------------------------------

### See Also

CreateImageClip AddImageClip SIAddImageSource Clip.Source