[Digikam-users] Images.uniquehash calculation

Marcos Dione mdione at grulic.org.ar
Mon Jun 17 21:37:53 BST 2013


On Mon, Jun 17, 2013 at 09:14:40PM +0200, Jean-François Rabasse wrote:
> Marcos's Python script opens the file in text mode, the default with
> Python (and Unix open primitive).
> This means that each time the image file (a binary stream) contains
> bytes that relate to end of lines, CR (Apple) or CR-LF (Microsoft),
> they will be translated into a Unix line feed LF.
> Thus the 100 Kb buffer is modified and of course the md5 hash computation
> is modified too.
> 
> Marcos, open in binary mode in your script, line #10
>  f = open (fname, 'b')

    actually the mode has to be 'rb'. still no cigar:

mdione at diablo:~/Pictures$ sqlite3 digikam4.db 
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from Images where name='DSC_9531_9532.tif';
44205|683|DSC_9531_9532.tif|1|1|2013-01-06T23:36:02|27272850|9bc1b21ee7fbc2fba60a150e00d54b5f

mdione at diablo:~/Pictures$ python resize.py incoming/stitch/DSC_9531_9532.tif 
7fb76fbde85e2ba15604482c0b54343a

    this time I made sure the image is recent enough, as I was not sure
if hashes were updated when the new version of the algo was put in place.

-- 
(Not so) Random fortune:
[12:32] <xanthus> el viaje mas largo que hice fue cuando sali del vientre de mi
    madre



More information about the Digikam-users mailing list