Skip to content

Instantly share code, notes, and snippets.

@fbuchinger
Created July 9, 2011 18:26
Show Gist options
  • Save fbuchinger/1073823 to your computer and use it in GitHub Desktop.
Save fbuchinger/1073823 to your computer and use it in GitHub Desktop.
.picasa.ini decoded
#==============================================================
# .picasa.ini FILE STRUCTURE
#
# reverse-engineered by Franz Buchinger <fbuchinger@gmail.com>
# licensed to the public domain
#
# Picasa Version(s): 3.8.0
#
# Changelog:
# v0.1: initial release
# ==============================================================
#---------------------------------------------------------
# 1. Picasa Section
#
# The picasa section contains album-related metadata.
# Obviously, it is only present if the image folder was
# converted to a picasa album or if it was created during
# an import of images from a digital camera.
#---------------------------------------------------------
[Picasa]
# the name of the album
name=Foo Bar birthday
# category: "Folders on Disk" for local albums
category=Folders on Disk
#if album was downloaded from picasa web albums, a key in this format
# is stored
P2category=Downloaded Albums~otheruserid
#if the album was uploaded, the username and album id are referenced in this format: <picasa user name>_lh=<picasa web album id>
joedoe_lh=5620038667642797505
#-------------------------------------------------------------
# 2. Contacts Section
#
# the contacts section matches the recognized faces of
# persons to the contacts of the picasa user.
# format <person_id>=<picasa user name>_lh,<picasa contact id>
# TODO: what about not-yet confirmed or unidentified faces
#--------------------------------------------------------------
[Contacts]
d10a8325c557b085=joedoe_lh,cb989580bc43a91
8e62398ebda8c1a5=joedoe_lh,4bd750800fb6a6b8
d736528ba71f2254=joedoe_lh,6dc6a330c4804e8
#---------------------------------------------------------------
# 3. Photo Entries
#
# each photo found in the current directory gets one ini section
# in the file, named after its filename. depending on the file
# type (jpeg vs camera raw), different metadata is stored in the
# section.
#----------------------------------------------------------------
[P7025200.ORF]
# 3.1 BASIC METADATA
#added if image was starred in picasa
star=yes
#caption entered in picasa
#(only added for non-jpeg photos, stored as IPTC Caption for jpeg photos)
caption=dummy
#keywords assigned in picasa
#(only added for non-jpeg photos, stored as IPTC Keywords for jpeg photos)
keywords=beer,empanadas,keyword with spaces
#backuphash - not yet decoded
backuphash=36003
#if the pictures of the album have been uploaded
# a key/value pair in the format IIDLIST_<picasa user name>_lh=<64-bit hexadecimal photo id>
# is added to each photo entry.
IIDLIST_joedoe_lh=4dfe636c9cf4c302
# 3.2 FILTER SETTINGS
# all applied filters per photo are recorded to .picasa.ini
# to provide an editing history and/or an easier undo facility.
# Basic filter key format:
# the filters key of each photo stores a semicolon-separated list of filter entries:
filters=enhance=1;crop64=1,45930000ba03defe;
# each entry follows the format
# <filter identifier>=1,<filter value 1>,<filter value 2>,<..filter value n>;
# Here is a list of valid filter identifiers
#
#|--Identifier-|--------------Parameters-------------|----------Description-----------|---------Example---------------|
#| crop64 | CROP_RECTANGLE* | crop filter, crops the image | crop64=1,30a730d2bf1ab897 |
#| | | according to crop rectangle | |
#| tilt | !TILT_ANGLE,!SCALE | tilts and scales image | tilt=1,0.280632,0.000000 |
#| redeye | | redeye removal | redeye=1 |
#| enhance | | "I'm feeling lucky" enhancement| enhance=1 |
#| autolight | | automatic contrast correction | autolight=1 |
#| autocolor | | automatic color correction | autocolor=1 |
#| retouch | | retouch | retouch=1 |
#| finetune2 | (unidentified params) | finetuning (brightness, | finetune2=1,0.000000,0.000000,|
#| | |highlights, shadows,color temp) | 0.000000,fff7f5f3,0.000000; |
#| unsharp2 | !AMOUNT | unsharp mask filter | unsharp2=1,0.600000; |
#| sepia | | sepia filter (no params) | sepia=1 |
#| bw | | black/white filter (no params) | bw=1 |
#| warm | | warming filter (no params) | bw=1 |
#| grain2 | | film grain filter (no params) | grain2=1 |
#| tint |!!PRESERVE_COLOR ,#TINT COLOR | tint filter | tint=1,79.842102,ffff |
#| sat |!SATURATION | saturation filter | sat=1,0.161800; |
#| radblur |!MOUSE_X,!MOUSE_Y,!SIZE,!AMOUNT | radial blur | radblur=1,0.500000,0.500000, |
#| | | | 0.239766,0.146199; |
#| glow2 |!INTENSITY,!!RADIUS | glow effect | glow2=1,0.650000,3.000000; |
#| ansel |#COLOR | filtered black/white | ansel=1,ffffffff; |
#| radsat |!MOUSE_X,!MOUSE_Y,!RADIUS,!SHARPNESS | radial saturation | radsat=1,0.421652,0.594697, |
#| | | | 0.333333,0.309942; |
#| dir_tint |!MOUSE_X,!MOUSE_Y,!GRADIENT,!SHADOW | directed gradient | dir_tint=1,0.306743,0.401515, |
#| | | | 0.250000,0.250000,ff5bfff3; |
#
# LEGEND:
# ! = float between 0 and 1, precision:6
# !! = float with arbitrary range, precision:6
# # = 32-bit color in hex notation, e.g.: fff7f5f3
# [] = crop rectangle
# 3.3 TEXT EDITS
text=1;136;11;sample text;Aharoni;0.279301,0.503929,0.033333,0.000000;v1,4294967295,4278190080,128.000000,1.000000,0.364486,0.878906,700,258,49152;;
textactive=1
# 3.4. RECOGNIZED FACES
# all recognized faces are stored as bigint crop rectangles in the faces key
# format faces=rect64(CROP_RECTANGLE*), contact_id;
faces=rect64(3f845bcb59418507),8e62398ebda8c1a5;rect64(9eb15e89b6b584c1),d10a8325c557b085
#
# APPENDIX
#
# A.1 DATA TYPES
# A.1.1 CROP BOX RECTANGLES (*)
# Picasa uses a special string format to store crop boxes of
# detected faces and from an applied crop filters. The number encased
# in the rect64() statement is a 64 bit hexadecimal number:
# rect64(3f845bcb59418507)
# break this number into 4 16-bit numbers by using substrings:
# '3f845bcb59418507'.substring(0,4) //"3f84"
# '3f845bcb59418507'.substring(4,8) //"5bcb"
# '3f845bcb59418507'.substring(8,12) // "5941"
# '3f845bcb59418507'.substring(12,16) // "8507"
# convert each obtained substring to an integer and divide it
# by the highest 16-bit number (2^16 = 65536), which should give 0 < results < 1.
# these are the relative coordinates of the crop rectangle (left,top,right,bottom):
# parseInt("3f84",16)/65536 //0.24810791015625 - left
# parseInt("5bcb",16)/65536 //0.3585662841796875 - top
# parseInt("5941",16)/65536 //0.3486480712890625 - right
# parseInt("8507",16)/65536 //0.5196380615234375 - bottom
# for absolute coordinates, multiply the left/right coordinates with
# the image width and the top/bottom coordinates with the image height
# A.1.2 FRACTIONAL FLOATS (!)
# floats between 0 and 1 with a precision of 6 digits, e.g. 0.306743.
# Often used to encode relative settings or mouse positions.
# A.1.3 FLOATS (!!)
# arbitrary floats with a precision of 6 digits
# A.1.4. COLORS (#)
# colors are stored as 32-bit hex string, e.g. ff5bfff3
@VijayS1
Copy link

VijayS1 commented Mar 24, 2014

With picasa v3.9.137, we have an [.album:343asdf34asdf] section with
Name
token
description
date

also the [img] sections,
have an albums tag, which a csv of album tokens.

@anton-rudeshko
Copy link

Great job, @fbuchinger!

@dolmen
Copy link

dolmen commented Aug 3, 2014

Missing entries seen in the wild for a picture:

  • category
  • flipped
  • rotate
  • height
  • width
  • moddate
  • redo
  • crop

Missing sections seen in the wild:

  • encoding

See also:
http://skisoo.com/blog/en/2013/how-to-read-picasa-3-9-database-and-extract-faces/
http://www.organizepictures.com/2013/09/everything-you-need-to-know-about-picasa-metadata

@bremme
Copy link

bremme commented Aug 27, 2014

A little addition on the "[Contacts]" section. I think if you are logged into your Google account you will indeed get the "[Contacts]" section in your picasa.ini files. But if you only use local contact, you will get a "[Contacts2]" section which looks like this:

[Contacts2]
b8e4117cf1d6615b=Roy Avery;;
47d06f0716518784=Kenyatta Folkers;;
7913c869eff350e5=Beatris Riveria;;

Other than that, the actual reference to the face tag rectangle is the same, e.g.

faces=rect64(3f845bcb59418507),7913c869eff350e5;rect64(9eb15e89b6b584c1),47d06f0716518784

Side-note
By doing so, I think, you don't even need a contacts.xml file to properly import the face tags since all the required information is already in the picasa.ini file(s) (If you write your tags to xmp, which I would suggest, importing will always work properly anyway)

@bremme
Copy link

bremme commented Aug 27, 2014

Another addition on your contact TODO, when a face is recognized but "not yet confirmed" (the rectangle around the face is known and a name is suggested). You will see: ffffffffffffffff as the <contact_id> like this:

[image.jpg]
faces=rect64(92b80000ffd4b7b3),ffffffffffffffff

When a face is detected but there is not suggestion ( unidentified faces), nothing will show up in the picasa.ini file.

@felciano
Copy link

felciano commented Dec 6, 2014

This is great -- thanks for putting it together! I'm trying to reconstruct a set of Picasa albums that were overwritten. I've restored the .picasa.ini files from a backup but the albums still aren't refreshing correctly in the UI. Is there a way to force that to happen, or to otherwise force Picasa to update itself from the these .picasa.ini files?

@jneander
Copy link

jneander commented Aug 8, 2015

Has anyone determined the significance of moddate?

@curtallred
Copy link

Regarding the [Contacts] and [Contacts2] sections... I wrote a Lightroom plugin for migrating from Picasa to lightroom which converts all picasa data from the ini files and imports into to Lightroom (http://picasa-lightroom.com/). It represents each "contact" as a lightroom collection. It failed for one user who had been using Picasa for many years and many versions. Her picasa.ini file had both a [Contacts] and [Contacts2] section. The [Contacts2] section did not follow the format above. It seemed to be the same format of the old [Contacts] section but with a different hash ID after the comma.

Here are the exact sections, except I changed the real google user name to "gusername":

[Contacts]
5f77f57cb52e692f=gusername_lh,24
6bdfb483883b2240=gusername_lh,4a85b54a8ce2cf5e

...
[Contacts2]
5f77f57cb52e692f=gusername_lh,pAaGvJzUJogbyOHe35zrLvk0eDu008jLD35j21Br71E

Questions:

  • Does anyone know the rules behind the above migration from Contacts to Contacts2?
  • Whats the difference between the comma and semicolon separators?
  • It seems like at some version of Picasa, they switched from Contacts to Contacts2. If the old Contacts section is present, is it used at all? or is all the information transferred to Contacts2?

@Benevolent
Copy link

Thanks for keeping this still alive. I am trying to mimic picasa with scala based implementation (a bit of overkill, but excellent practice). For this any support on contents of .picasa.ini decoding is interesting.

Here are few enigmas in terms of hex dump. Logic somehow explains the usage.
.
.
album=604c294a68b0de9cc9222c4714f289d5
.
.
[.album:604c294a68b0de9cc9222c4714f289d5]
name=P_r_a_t_i_c_A
token=604c294a68b0de9cc9222c4714f289d5
date=2010-03-17T02:44:57+02:00

@SlimJimPoisson
Copy link

This may not be useful to anyone so far after, but I created a VBA function to apply Picasa cropping to image files. Hope it helps!

 Sub CropImage(byval SourceImagePathFileName As String, CroppedImagePathFileName As String, byval Rect64 As String, ByVal ImageWidth As Integer, byval ImageHeight As Integer)

	'Uses Microsoft Windows Image Aquisition Library v2.0
	'or Dim as Objects and then use CreateObject("WIA.ImageFile"), etc.
    Dim WIAImage As New WIA.ImageFile
    Dim WIAImageProcess As New WIA.ImageProcess

    Call WIAImage.LoadFile(SourceImagePathFileName)
    Call WIAImageProcess.filters.Add(WIAImageProcess.FilterInfos("Crop").FilterID)
    
    Rect64 = Right(string(16, "0") & Rect64, 16)
    With WIAImageProcess.filters(1)
        .Properties("Left") = (CLng("&H" & Mid(Rect64, 1, 4)) / 65536) * ImageWidth
        .Properties("Top") = (CLng("&H" & Mid(Rect64, 5, 4)) / 65536) * ImageHeight
        .Properties("Right") = ImageWidth - ((CLng("&H" & Mid(Rect64, 9, 4)) / 65536) * ImageWidth)
        .Properties("Bottom") = ImageHeight - ((CLng("&H" & Mid(Rect64, 13, 4)) / 65536) * ImageHeight)
    End With
    
    Set WIAImage = WIAImageProcess.Apply(WIAImage)
    If Dir(outFile) <> "" Then Kill outFile
    Call WIAImage.SaveFile(outFile)

End Sub

`

@DougRogers
Copy link

Hello all.
I am writing an image organization tool that will import picasa.ini files. This document has helped a lot with processing, but I do not have enough real examples of all the possible fields. If the author will allow it, I am asking for people to post .ini files or at least snippets from the files.

@SlimJimPoisson
Copy link

Hello all. I am writing an image organization tool that will import picasa.ini files. This document has helped a lot with processing, but I do not have enough real examples of all the possible fields. If the author will allow it, I am asking for people to post .ini files or at least snippets from the files.

I scanned around 800 .picasa.ini files and found the following.

Most of the sections contain one of the file names from the directory with the following fields:

albums=65d12673f3b51e3fc3006f7cc3d01e54
backuphash=10002
BKTag All Pictures-backuphash=10005
caption=
crop=rect64(10000000f1ddff49)
faces=rect64(18fe0cc96f9357f5),632e71e2ffd6c6d;rect64(97070ba0ef375859),632e71e2ffd6c6d
filters=autocolor=1;autolight=1;enhance=1;autolight=1;autocolor=1;
filters=crop64=1,10000000f1ddff49;
filters=crop64=1,105034a0ffffd6d2;finetune2=1,0.333333,0.176842,0.193684,00000000,0.000000;
geotag=33.770556,-84.293055
height=3456
IIDLIST_name_lh=4da0bbdd9d705362
keywords=Key1,Key2
moddate=8094e2826277cd01
originhash=033f1132c87469f2bb7c5f4e41c18e6b
redo=autocolor=1;
redo=crop64=1,1c000934f322d3f8;
redo=enhance=1;
redo=unsharp=1,0.748538;
rotate=rotate(0) (0-3)
screensaver=yes
star=yes
textactive=0
width=5184

I have included a random example (or more) in most cases. I don't have any insight into some of these fields or values.

There were several other sections that appeared with from occasionally to rarely appear.

The [Picasa] section was most common. I found the following fields:

date=28653.387326
description=Default album for newly uploaded photos.
name_lh=5593677179451574065 (name was my name)
link=https://picasaweb.google.com/data/feed/back_compat/user/...
P2category=

There were two sections [Contacts] and [Contacts2], ironically [Contacts2] was far more common. No clue about these fields.

05292=hsahp
05292=hsahpukcab
05292=hsahpukcab-serutciP llA gaTKB
1447b1ab3ef73a70=Name;;
b1881b43b57eebb1=name_lh,6a44442f8e272c6b

[(null)] sections were usually blank but sometimes had an album field with the format d9c69752d39d957ca6b30faa28a0af9f.

Some sections appear like [.album:00f20de01a6ae500a676a7093fb00d53] with the following fields:
date=2004-12-26T14:21:40+08:00
description=19 results: name, faces
name_lh=5943079517704006497 ("name" was my name)
location=City, State, Country
token=00f20de01a6ae500a676a7093fb00d53

Finally, very rarely there was a [photoid] with a long list of lines that look like this:

5593677297697706850=Filename.jpg

Let me know if I can provide anything further.

@DougRogers
Copy link

@SlimJimPoisson Thank you. I will use these as test cases. I appreciate you taking the time to do this.

@DougRogers
Copy link

I think Contacts2 is version 2 of the Contact data.

I think 'redo' are commands that have been undone and can now be redone. I will add those to command stack.

I have not seen the link command. I wonder if they are active since they point to picasa web. Do those links work for you? I suspect I should ignore that field.

I can't figure out the moddate format, which I assume is modification date.

geotag looks like longitude/latitude

Can you post a photoid header? I have not seen that one.

I'm guessing width/height are just image info

I'm ignoring all the hash commands since I have no idea what they are.

@Philipp91
Copy link

I'm wondering about the encoding of these files. Is it UTF-8?

@DougRogers
Copy link

@Philipp91 In English language Windows, .picasa.ini files are encoded in UTF-8

Other languages will probably need a different encoding to support the character set for the file names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment