Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked September 15th 2010 by Parand Darugar
  • mobile
  • scale
  • scaling
0 Comments

1 Answer

  • Try this:

    image.transform = scale;

    — answered September 15th 2010 by James K
    permalink
    2 Comments
    • That doesn't appear to do anything. I can set the transform, but there's no evidence it's actually resizing the image.

      — commented September 15th 2010 by Parand Darugar
    • I seem to be having the same issue. Any updates on this? :)

      — commented October 20th 2010 by Christopher Stevens
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.