How to access image in Contacts app on Android?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
ddabrahim
Party member
Posts: 182
Joined: Mon May 17, 2021 8:05 pm
Contact:

How to access image in Contacts app on Android?

Post by ddabrahim »

Hi.

It is not necessarily a Love2D question, if Love2D can do it, it's great, but I am open to any ideas and solutions.

I have an old Android phone running Android 4 and using the Contacts app I took a picture for a contact. Now I would like to transfer this image to an other device but unfortunately I have no idea where is it stored on the device or in what format.
After some searching, some people was suggesting the image is stored on the SIM card, others suggesting the image is stored on the device but encrypted or stored inside a database somewhere.

Could not find a straight answer and a solution regarding how to access the image.
Would anyone have some idea how to get this image?

If I was able to at least display it in large and make a screenshot would be enough but this Contacts app doesn't display the image in large, only display it as thumbnail for the contact which is too small.

I would appreciate any help.
Thanks.
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: How to access image in Contacts app on Android?

Post by milon »

If you're signed in to a Google account, then the photo is likely synced to that account. You could go to accounts.google.com to (likely) retrieve the photo.

Beyond that, I don't have access to any Android 4 devices, but these links may help:
https://www.fonecope.com/where-are-cont ... droid.html
https://www.unlockunit.com/blog/where-a ... n-android/
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
ddabrahim
Party member
Posts: 182
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: How to access image in Contacts app on Android?

Post by ddabrahim »

Unfortunately the image does not sync to my google account but the links you have shared looks very promising. Thanks a lot!
User avatar
ddabrahim
Party member
Posts: 182
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: How to access image in Contacts app on Android?

Post by ddabrahim »

Hi all!

Just would like to post on update on this.
Unfortunately I was unable to locate the database where contacts are stored. As described in the article above, it is depends on the manufacturer of the device. The folder where contacts supposed to be stored was empty or maybe protected I should root the device.

But fortunately I was able to export the contact in VCF format from the Contacts app which did include the image data.
Transferred the file to my Mac and I have opened the file in a text editor and removed all the header info including the line

Code: Select all

PHOTO;ENCODING;TYPE:
So the only thing I left with is the actual image data.
Saved the file and then on macOS I was able to convert .VCF to JPEG using the following terminal command

Code: Select all

base64 -D -i contact.vcf -o image.jpeg
There are apps dedicated to extract images from VCF but the above terminal command did work for me on Mac.
However it is half success because the only thing I have is the 96x96 preview of the image, I was hoping when I taken the photo it was captured a higher resolution image. But it is possible the Contact app did take only this low res image or the higher res image is hidden somewhere.

One lesson I learned from this, I never going to use the Contacts app ever again to take photos. I'm going to use the Camera and then set the image for the contacts manually.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 43 guests