Skip to content

liambibikov/phone-link-photos-recovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Extract Photos (Thumbnails) from SQLite Database Cached by Phone Link on Windows

Overview

This script extracts image thumbnails from a SQLite database used by the Phone Link app on Windows. It was created for users whose devices were paired with Windows via Phone Link and whose original device has been damaged, but the thumbnails are still stored in the SQLite database file.

Note: Thumbnails are a last resort as their quality is lower than the original images. Therefore, this solution may be useful for those who might want to attempt to retrieve photos from the Phone Link database if no other option is available to retrieve the originals from the phone or backups. It might be usable to at least attempt to save the low-resolution thumbnails of the photos as a better-than-nothing option.

Prerequisites

  • SQLite database file: The database file (e.g., photos.db) used by the Phone Link app.

    Important: Copy the database file from Phone Link's appropriate directory instead of moving it. Working on the copied file ensures that the original remains intact in case anything goes wrong during the extraction process.

    • Multiple database files: If there are multiple photos.db files in different directories, try each one separately, as some may be empty or contain different sets of thumbnails.
  • PowerShell: This script works on Windows using PowerShell.

  • SQLite: Needed to query the database.

Instructions

Step 1: Download and Install SQLite

To interact with the database, you need to have SQLite installed on your Windows machine.

  1. Download SQLite tools (e.g., sqlite-tools-win-x64-3480000.zip) from SQLite Official Website.
  2. Extract SQLite tools to a folder, such as C:\sqlite.
    • You may need to create the sqlite folder in C:\ or another directory if it does not already exist.
  3. Add SQLite to PATH in Windows system settings.
    • Open Search in Windows and type Edit environment variables for your account.
    • In the Environment Variables window, under User variables, find or create a variable named Path and add C:\sqlite (or your different directory with the extracted SQLite tools).

Step 2: Set Up Script

  1. Save the script: Copy the script below into a new file and save it as extract_thumbnails.ps1, or download the one available in this repository.
  2. Prepare the database file: Place the SQLite database (photos.db) in the same folder as the script or adjust the $DB variable in the script to point to the correct path.

Step 3: Run the Script

  1. Open PowerShell as Administrator.
  2. Navigate to the script directory:
    cd "C:\path\to\your\script\directory"
  3. Run the script using:
    powershell -ExecutionPolicy Bypass -File extract_thumbnails.ps1

Step 4: Wait for the Script to Finish

Once the script is running, wait for it to complete. If any thumbnails are available in the database, they will be extracted to the extracted_thumbnails folder in the same directory as the script.

Features

  • Automatically Handles Multiple Formats: Supports jpeg, png, heic, gif, webp, bmp, tiff, svg, ico, and x-adobe-dng.
  • Prevents Duplicate Extensions: Ensures no duplicate extensions (e.g., .jpg.jpg).
  • Output Directory: Saves extracted thumbnails into \extracted_thumbnails by default.

Troubleshooting

  • SQLite Installation: If sqlite3 is not recognized, ensure SQLite is installed and added to your system PATH.
  • Missing Thumbnails: If some thumbnails are not extracted, the database's thumbnail field may be empty or corrupted for those images. The script tries to extract thumbnails in a usable state; success depends on the integrity of the data in the database.

License

This script is released under the MIT License. For more details, see the LICENSE.md file.