Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Photo Extractor for Treo 600 Phone/PDA/Camera

by Paladin (Priest)
on Dec 06, 2004 at 16:08 UTC ( #412679=snippet: print w/ replies, xml ) Need Help??

Description: I recently got a new Treo 600 Phone/PDA/Camera and found there was no good software to extract the pictures from the phone. After doing some research on the format of the files, I put together the following. Just edit the $syncdir variable at the top to point to where your files are.
#!/usr/bin/perl -w

use strict;
use Palm::PDB;
use Palm::Raw;

# Set this to the dir the ImageLib_imageDB.pdb
# and ImageLib_mainDB.pdb files are in
my $syncdir = ".";
my %imagedata;

my $imagedb = new Palm::PDB;
my $maindb = new Palm::PDB;

# Gather picture data, indexed by Record ID.  The phone has only 32Meg
# of memory, so it shouldn't be restrictive to load all the data into
# memory
foreach my $record (@{$imagedb->{records}}) {
    $imagedata{$record->{id}} = $record->{data};

# Records in the mainDB give the filename, and record number
# of the start of each picture
foreach my $record (@{$maindb->{records}}) {
    my ($file, $startpic, $startthumb, $nbrecpic, $nbrecthumb)
            = unpack "A32x8Lx4LSS", $record->{data};

    print "$file.jpg";
    open JPG, ">", "$file.jpg" or die "Couldn't open $file.jpg: $!\n";
    my $nextrec = $startpic;
    # Write data to image file, following the Next Record pointers
    # until the last one is found
    while ($nextrec != 0) {
        my ($next, $data) = unpack "La*", $imagedata{$nextrec};
        print JPG $data;
        print ".";
        $nextrec = $next;
    print "\n";
    close JPG;

Comment on Photo Extractor for Treo 600 Phone/PDA/Camera
Download Code

Back to Snippets Section

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://412679]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2015-12-01 04:26 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (792 votes), past polls