Question

I have an image view, and after getting the image and setting the image view I am having a simple problem.

Depending on if it is landscape or portrait, and if the image view is a square, the image view will not be filled. The only way I can achieve this using a landscape photo is to essentially crop it, otherwise it is stretched.

The trouble is - by cropping the photo into a square that I can then resize - I end up losing the areas that I have cropped, making way for an incomplete photo.

Alternatively, I could force the image to fill the view, but it will end up being stretched in the process.

Is there anyway to achieve this? I have already looked at imagefactory, but haven't had much luck.

Thanks

Was it helpful?

Solution

Here goes a method for making an imageView exactly of image so it does not get crop or blur.You have to use a temporary image for this purpose

var imageTemp = Ti.UI.createImageView({
  image : someFile.read(),
  height:'auto',
  width:'auto'
});
Ti.API.info( "height=" + imageTemp.size.height);
Ti.API.info( "width=" + imageTemp.size.width);
imageTemp = null;

Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top