Object Hierarchy | Related C++ Class: Image
v2.0
This class provides read-access to the representation of an
image in memory.
For the vast majority of image files, Softimage represents the data
in memory as uncompressed 8-bit RGBA. This is true even if the
original file has no alpha information. The format of the data can
be determined with Image.NumChannels and Image.ChannelSize.
| 
' The script demonstrates the relationship between the Image, ImageClip and Source
' objects
Option Explicit
' ----------------------------------------------------------------
' create a new image clip
' ----------------------------------------------------------------
newscene , false
dim oImageClip 
set oImageClip = CreateImageClip( _
                "$SI_HOME\Data\XSI_SAMPLES\Pictures\jio.jpg", _
                "MyImage" )
logmessage "image familes->" & oImageClip.families
' ----------------------------------------------------------------
' get startframe, endframe, xdimension and ydimension parameters
' ----------------------------------------------------------------
if typename(oImageClip) <> "Nothing" then
        'Use the source to get image information
        dim oImageSource : set oImageSource = oImageClip.Source
        logmessage "startframe->" & oImageSource.FrameStart.Value
        logmessage "endframe->" &  oImageSource.FrameEnd.Value
        logmessage "xdimension ->" &  oImageSource.XRes.Value
        logmessage "ydimension ->" &  oImageSource.YRes.Value
        'Read bottom left pixel 
        dim oImage : set oImage = oImageClip.GetImage
        dim oPixel : set oPixel = oImage.GetPixel( 0, 0 )
        logmessage "The pixel color is:"
        logmessage "R: " & oPixel.Red 
        logmessage "G: " & oPixel.Green
        logmessage "B: " & oPixel.Blue
        logmessage "A: " & oPixel.Alpha
        logmessage "xdimension (method2) ->" &  oImage.ResX
        logmessage "ydimension (method2)->" &  oImage.ResY
        logmessage "Channels ->" &  oImage.NumChannels
        logmessage "Channel Size (bytes) ->" &  oImage.ChannelSize       
end if
' ----------------------------------------------------------------
' Demonstrate how to find all image clips in the scene
' ----------------------------------------------------------------
logmessage "All image clips in Scene:"
dim oImageClips : set oImageClips = Project_GetImageClips()
for each oImageClip in oImageClips
        logmessage "Image Clip->" &oImageClip 
next 
' ----------------------------------------------------------------
' Return collection of project image clips
' ----------------------------------------------------------------
function Project_GetImageClips()
        dim oCol : set oCol = enumelements( "Clips.Image" )
        set Project_GetImageClips = sifilter( oCol, "Image Clips", ,siSearchFamilies )
end function
 |