Skip to content

Instantly share code, notes, and snippets.

@QGao
Created December 13, 2011 19:30
Show Gist options
  • Save QGao/1473514 to your computer and use it in GitHub Desktop.
Save QGao/1473514 to your computer and use it in GitHub Desktop.
toImage to png file sample
var win = Ti.UI.createWindow({
backgroundColor:'#fff'
});
var view = Ti.UI.createImageView({
height: 200,
backgroundColor:'#f00'
})
win.add(view);
var image = view.toImage();
Ti.Filesystem
.getFile(Titanium.Filesystem.applicationDataDirectory, 'snapshot_blob.png')
.write(Ti.Android ? image.media : image);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment