Why contact photo have are bad quality/resolution?

585 Views Asked by At

Why if i get photo from URI is have are bad quality(1 photo), but in standart Phone app resolution is good(2 photo) and why i have contacts not from my contacts book (3 photo)? What i need to do?

// Display Name
map.put("NAME", (String)cursor.getString( cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)));

// Photo Bitmap
Bitmap tmpPhoto = null;
final ContentResolver resolver = getContentResolver();
Cursor sCur = resolver.query(
              ContactsContract.Data.CONTENT_URI,
              null,
              ContactsContract.Data.CONTACT_ID + "=" + id + " AND "
              + ContactsContract.Data.MIMETYPE + "='"
              + ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE + "'", null,
                        null);
if (sCur == null) {
     tmpPhoto = null;
    }
else
{
Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long
                            .parseLong(id));
InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(resolver, uri);
    if (input == null) {
         tmpPhoto = null;
        }
    else {
        tmpPhoto= BitmapFactory.decodeStream(input);
         }
}
sCur.close();
map.put("PHOTO", (Bitmap)tmpPhoto);

My App

enter image description here

Standart App

enter image description here

Theese 3 contacts not from my book

enter image description here

1

There are 1 best solutions below

2
On

Mostly every app developer wants to preserve his heap, so the results, the actual pictures are copied and trimed/scaled to a lower resolution dimensions so as to be displayed in the ListView. when you select that picture the image is then retrieved from its full dimension and displayed(maybe scaled to fit the developer's assisnged space)..

in your case i do not see a picture resolution difference, one is being scaled by android to a smaller display area compared to the other(standart)