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 without losing resolution

If I have a 1000x1000 png file, and load it into an imageView with the width at 100, can I then scale the image (animate) up …ie., zoom it up to a larger view without it looking like a pixelated version of the imageView?

Basically I am looking to zoom from a thumbnail to a full sized image.

When I do:

var imgView = Titanium.UI.createImageView({
    image:imgFile,
     width:100,
    height:'auto'
});
var zoomImage = Titanium.UI.createAnimation();
t = Ti.UI.create2DMatrix();
t = t.scale(5.0);
zoomImage.transform = t;
zoomImage.duration = 400;

imgView.animate(zoomImage);

The zoomed image is pixelated. Yet the original on the hard drive is 1000x1000 - i'd love to see that in it's full glory.

Thanks for any insight.

— asked August 22nd 2010 by Dan Newman
  • image
  • resultion
  • scale
  • zoom
0 Comments

3 Answers

  • Accepted Answer

    Try to set backgroundImage:'/img.png' instead of image attribute

    — answered August 22nd 2010 by Vitali Virulaine
    permalink
    0 Comments
  • yeah that works - tho it appears that 'auto' does not work as a sizing option in this case? which i think i can work around so this is a good step. much thx.

    — answered August 22nd 2010 by Dan Newman
    permalink
    0 Comments
  • I usually scale image for work needs, but my the resolution of image after scaling is still the same with the source image file. Is there difference between our image scalers?

    — answered March 5th 2014 by HILLARY HALL
    permalink
    1 Comment
    • Hi, Hillary Hall.
      Could you offer some recommendations about the fine image scaling SDK which won't lose too muach resolution of the images? Thanks in advance.

      Best regards,
      Arron

      — commented April 8th 2014 by arron lee
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.