Transferring ratings from Gallery2 to ACDSee


Recently I wanted to transfer the image ratings from one of my online photo galleries into the ACDSee program I use to manage my photos at home. It was a large album, thousands of photos, so doing this by hand was just not going to happen. Here’s how I did it.

Gallery2 does not have any mechanism for exporting ratings. So I used a simple SQL query on the Gallery2 database, which I ran in phpMyAdmin. This is the query I used:

select g_title, g_rating from g2_ratingMap, g2_Item where g_itemId=g_id and g_id in (select g_id from g2_ChildEntity where g_parentId=(select g_id from g2_Item where g_title='NAME OF ALBUM')) and g_ratingId=(select max(g_ratingId) from g2_ratingMap where g_itemId=g_id)

This query returns only the most-recent rating applied to each image, which is what I wanted. Gallery2 normally displays the average of all ratings. If that’s what you want, you could use this somewhat-simpler query:

select g_title, avg(g_rating) from g2_ratingMap, g2_Item where g_itemId=g_id and g_id in (select g_id from g2_ChildEntity where g_parentId=(select g_id from g2_Item where g_title='NAME OF ALBUM')) group by g_id

I had phpMyAdmin export the results of this query as an Excel spreadsheet, which I downloaded to my PC. It looked like this:

A B
1 IMG_6423 1
2 IMG_6424 2

I then added a new column, with this formula:

="rename " & A1 & ".JPG " & B1 & "\" & A1 & ".JPG"

The result is a new column containing the following lines:


move IMG_6423.JPG 1\IMG_6423.JPG
move IMG_6424.JPG 2\IMG_6424.JPG
move IMG_6425.JPG 1\IMG_6425.JPG
...

I saved this column as a .BAT file, in the folder that contains all the images. I created subfolders named 1, 2, 3, 4, and 5. Ran the batch file, which moved each image into the appropriate subfolder for its rating.

Then I went back into ACDSee. Browsed to the new subfolders. Select all the files in each subfolder, and apply the appropriate rating. Finally, in ACDSee, move all the files back into the original folder. This last step must be done from inside ACDSee, so that the ratings (which are stored in ACDSee’s own database) will follow the image.


Leave a Reply

Your email address will not be published. Required fields are marked *