Image resolution problem using Contacts Images

You must Login before you can answer or comment on any questions.

Hello,

i am using the Contacts Picker and storing a Contacts image locally in its original size. Then I place the image on a small imageview (57x57).

Using iPhone 4 the images look very pixelated on the image view. I see no difference, when using my old 3G.

I checked the images stored on the device and they all pretty big. So the Files are OK.

What can I do to make them look good on the Retina Display ?

— asked 3 years ago by David P.
0 Comments

5 Answers

With iPhone4 you need to store the images at double the size of that which you use on the previous versions of iPhone

If you were loading these from a file, you would append '@2x' to the end of the filename eg. For iPhone 3 you would use photo.png, and for iPhone4 you would use photo@2x.png.

This should probably be confirmed, but I imagine that you should create a TiBlob object at 114x114 for iPhone4 and 57x57 for iPhone3 and earlier.

You can do this with an if statement:

if (Titanium.Platform.model=='iPhone 4' || Titanium.Platform.model=='Simulator') { ... do stuff ... }
Hope this helps. Greg

— answered 3 years ago by Gregor Munro
answer permalink
1 Comment
  • This would mean i would have to detect the Device. But this doesnt seem to be possible, currently.

    — commented 3 years ago by David P.

Loading the image with the @2x extension brings no difference.

i should have mentioned that i only have one file, stored from the contacts, in its original size

Perhaps i need to resize before saving and save 2 files to the device. 57X57 and a 114x114@2x. But i havent found a way to do this.

Do you have a copy of your code that you are using to display this image. Have you tried using backgroundImage rather than image?

Hello,

i still havent resolved this issue. Like i said, my code is working its just that the images from my contacts look very bad on the Retina Display.

First i am creating the imageview

var logoimage = Titanium.UI.createImageView({
    height:57,
    width:57,
    left:10,
    top:10
    });
Then i am running a function to refresh the image after a contact has been chosen and the image has been stored.
logoimage.image = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
Then adding the imageview to the Window
win.add(logoimage);
I have tried backgroundimage in the imageview, but this results on a crash on my device.

Hello,

i still havent resolved this issue. Like i said, my code is working its just that the images from my contacts look very bad on the Retina Display.

First i am creating the imageview

var logoimage = Titanium.UI.createImageView({
    height:57,
    width:57,
    left:10,
    top:10
    });
Then i am running a function to refresh the image after a contact has been chosen and the image has been stored.
logoimage.image = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
Then adding the imageview to the Window
win.add(logoimage);
I have tried backgroundimage in the imageview, but this results on a crash on my device.

Your Answer

Think you can help? Login to answer this question!