Back

GetThumbnail

JS Py
Hello World

Creates a downscaled copy of an existing image.

app.GetThumbnail( source, destination, width=-1, height=-1 ) → void

Pass -1 as width or height to keep the aspect ratio.

See Also: CreateImage

Example - Create Thumbnail

function OnStart()
{
    lay = app.CreateLayout( "absolute" );

    img = app.CreateImage( "/Sys/Img/Hello.png" );
    lay.AddChild( img );

    app.GetThumbnail( "/Sys/Img/Hello.png", "/sdcard/Hello_thmb.png", 100, -1 );
    thmb = app.CreateImage( "/sdcard/Hello_thmb.png" );
    lay.AddChild( thmb );


    app.AddLayout( lay );
}
from native import app

def OnStart():
    lay = app.CreateLayout( "absolute" )

    img = app.CreateImage( "/Sys/Img/Hello.png" )
    lay.AddChild( img )

    app.GetThumbnail( "/Sys/Img/Hello.png", "/sdcard/Hello_thmb.png", 100, -1 )
    thmb = app.CreateImage( "/sdcard/Hello_thmb.png" )
    lay.AddChild( thmb )


    app.AddLayout( lay )
    Copy     Copy All       Run      
Number: pixel
String: path to file or folder ( “/absolute/...” or “relative/...” )