Information Technology Reference
In-Depth Information
commands to create a text file and dump the database into this file in a SQL text format,
as shown in the following command lines:
$sqlite3 AddressBookImages.sqlitedb
SQLite version 3.7.12 2012-04-03 19:43:07
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .output AddressBookImages.txt
sqlite> .dump ABFullSizeImage
sqlite> .exit
The text file contains the image data in a hexadecimal encoding format. To convert this
output back to binary data and grab the images, run the AddressBookImageGrab-
ber.py Python script on the dump file, as shown in the following command. The Python
script source code is available in the code bundle of the topic.
$Python AddressBookImageGrabber.py AddressBookImages.txt
Writing ./AddressBookImages-Output/397.jpeg
Writing ./AddressBookImages-Output/129.jpeg
Writing ./AddressBookImages-Output/73.jpeg
Writing ./AddressBookImages-Output/508.jpeg [...]
Writing ./AddressBookImages-Output/456.jpeg
Writing ./AddressBookImages-Output/141.jpeg
Total 93 images are extracted
Tip
Downloading the example code
You can download the example code files for all Packt topics you have purchased from
your account at http://www.packtpub.com . If you purchased this topic elsewhere, you can
visit http://www.packtpub.com/support and register to have the files e-mailed directly to
you.
The script will create a directory named AddressBookImages-Output and place the
extracted JPEG images onto it. The images can be viewed using a standard image viewer.
The filename of each image will be the record identifier, which is associated with the Ad-
dressBook.sqlite database so that you can associate each image with a contact.
Search WWH ::




Custom Search