var filename = new Date().getTime() + ".jpg"; currentWidth = e.media.width; currentHeight = e.media.height;
blob = e.media;
if(currentWidth > 500 || currentHeight > 500) {
if(currentWidth > currentHeight) {
newWidth = 500;
newHeight = newWidth*currentHeight/currentWidth;
} else {
newHeight = 500;
newWidth = newHeight*currentWidth/currentHeight;
}
blob = Titanium.UI.createImageView({image:blob,width:newWidth,height:newHeight}).toImage();
}
var savedfile = Ti.Filesystem.getFile(Titanium.Filesystem.getApplicationDataDirectory(),filename);
savedfile.write(blob);
ive compressed image with this logic in perspective of height and width, but i want to know that do this logic compress images in memory too??
2 Answers
noo, lemme explain, take an example of camera of galaxy tab,suppose, ive installed an application in it which uses camera and after capturing image i want to reduce image size in consideration of memory .
25
Your Answer
Think you can help? Login to answer this question!