Scale an image with create2DMatrix().scale, without using a view?
I'd like to resize the image I get from the camera before saving/displaying/uploading it. I'm able to resize it by putting it into a view, but if I understand correctly I should also be able to use create2DMatrix().scale()?
My code looks like:
function scale_image(image, ratio) {
var scale = Titanium.UI.create2DMatrix().scale(ratio);
image.transform(scale);
}
The image.transform part fails. I know I can create a view and specify the transform on that view, but I'd like to scale the image first without putting it into a view. Is that possible? How do I use transform on an image?
1 Answer
-
Try this:
image.transform = scale;