Titanium Community Questions & Answer Archive

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

How do I get the actual resolution of an image?

When I have an image downloaded to disk, I try to get the width or height and I always seem to get back the size of the view and not the size of the image in the view.. how can I get the resolution of a random image?

— asked September 29th 2010 by dan bachelder
  • image
  • iphone
  • mobile
1 Comment
  • Did you ever figure this out? It can be done easily in JavaScript in a webView, but I would like to do this native as well.

    — commented October 12th 2010 by Jeff Bonnes

1 Answer

  •   var baseImage = Titanium.UI.createImageView({
        image : imageBlob,
        width : 'auto',
        height : 'auto'
      var imageWidth = baseImage.toImage().width;
      var imageHeight = baseImage.toImage().height;
    — answered October 14th 2011 by Jorge Chang
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.