Rethinking Tags

Ideas for improvements and requests for new features in XnView MP

Moderators: XnTriq, xnview

User avatar
m.Th.
XnThusiast
Posts: 1586
Joined: Wed Aug 16, 2006 6:31 am

Rethinking Tags

Post by m.Th. »

In the DB we have the table 'Images' which has for each image the field 'Tag' of type INTEGER.

However, the architecture isn't very good. Since 'Tag' is a sparse field (ie. very few tagged files in a sea of untagged ones) the best solution would be to move the 'Tag' field in another table to hold only the tagged files.

Benefits: (Much) faster. Allows the implementation of 'Albums' or 'Projects' (more or less temporary collections which usually users create for different purposes). A neat feature present in Lightroom, Zoner Photo Studio and IDImager.

However, in a catalog with 22598 images (mine) with the current architecture it works ok.

What do you think?
m. Th.

- Dark Themed XnViewMP 0.99.6 64bit on Win10 x64 -
User avatar
xnview
Author of XnView
Posts: 36812
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Rethinking Tags

Post by xnview »

Something like ImageID, Tag
Pierre.
User avatar
oops66
XnThusiast
Posts: 2004
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Rethinking Tags

Post by oops66 »

+1, ... Yes, good suggestion and "product improvement" too ;-)
XnViewMP Linux X64 - Debian - X64
User avatar
m.Th.
XnThusiast
Posts: 1586
Joined: Wed Aug 16, 2006 6:31 am

Re: Rethinking Tags

Post by m.Th. »

xnview wrote:Something like ImageID, Tag
Yes, sort of.

Database layer:

I will speak in SQL (not tested):

Code: Select all

-- first we'll create the Albums

Create Table Albums (AlbumID Integer Primary Key Autoincrement, AlbumName Text Not Null Unique);
Insert into Albums values(null, 'Tag'); -- the 'null' here will became 1 due of autoincrement. Do also a trigger or use the GUI to disallow the delete operation on this item

-- and now we'll use them in DB

Create Table AlbumsLink (AlbumID, ImageID, UNIQUE (AlbumID, ImageID));

Create Index Albums_ImageID_idx on AlbumsLink(ImageID);

Presentation (GUI) layer:


When one will tag/untag a photo, you will add/delete a record with the respective ImageID and AlbumID=1 (magic value)

Albums management

For the other albums you can have

1. a simple list like in Lightroom when you'll add/rename/delete albums (aka Collections in Lr terminology)

- or -

2. an entire browser like in Zoner Photo Studio:
ZPS.PNG
- or -

3. tabs at the bottom of the form like in IDImager (you can see also the right-click management menu)
IDI.png
Also, IDImager implements the notion of the temporary album which is emptied at the end of session (as you see, it is called Image Basket - someting similar can be configured in XnViewMP with Tags)

Of course, as I said, you will take care to show in your GUI metaphor only albums which have AlbumID>1 (ie. Select AlbumName from Albums where AlbumsID>1 order by AlbumName).

Photos management:

In each case adding a photo to an album/collection is done by dragging the selected file(s) over the list item/folder/tab.
Removing the photo is done by having the collection selected and chose from the right-click popup menu the "Remove selection from the current collection"

HTH
You do not have the required permissions to view the files attached to this post.
m. Th.

- Dark Themed XnViewMP 0.99.6 64bit on Win10 x64 -
User avatar
oops66
XnThusiast
Posts: 2004
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Rethinking Tags

Post by oops66 »

m.Th. wrote:...Also, IDImager implements the notion of the temporary album which is emptied at the end of session (as you see, it is called Image Basket - someting similar can be configured in XnViewMP with Tags)
... And it's sorted by default by the "EXIF date taken" (or if not : XMP, or IPTC, or creation date,...) probably, for having a pertinent chronology ... no ?
XnViewMP Linux X64 - Debian - X64
User avatar
m.Th.
XnThusiast
Posts: 1586
Joined: Wed Aug 16, 2006 6:31 am

Re: Rethinking Tags

Post by m.Th. »

oops66 wrote:
m.Th. wrote:...Also, IDImager implements the notion of the temporary album which is emptied at the end of session (as you see, it is called Image Basket - someting similar can be configured in XnViewMP with Tags)
... And it's sorted by default by the "EXIF date taken" (or if not : XMP, or IPTC, or creation date,...) probably, for having a pertinent chronology ... no ?

As you wish. Usually these systems are working like this (adapted for XnViewMP ;) ):

1. The user clicks on the Temporary Album. (by convension the Temporary Album(s) take internally negative IDs in order to be easily wiped by delete from AlbumLinks where AlbumID<0)
2. Extract IDs from DB (in my proposal Select ImageID from AlbumLinks where AlbumID=-1) in a comma list string (let's call them imgIDs
3. Extract EXIF - Select Meta from Images where ImageID in (imgIDs) - and based on this build my own internal data structure (usually a linked list/collection of objects with all the values in place)
4. Extract the thumbs - Select Data from Datas where ImageID in (imgIDs) - see why it is very good to have different DBs for metadata and thumbs?? This could be run in parallel.
5. Sort the in-memory structure from step 3 according with GUI settings.
6. Render / Display

AS YOU SEE ON STEP 5 it is entirely upon you how to display this.

As an aside, yes, I have the default setting in my thumbnail browser in almost all DAMs the 'EXIF date taken". :D

PS: Pierre, if you do something else compared with the steps above then perhaps you can have performance penalties. Especially if you issue more queries that above. Tell me and I'll have a look.
m. Th.

- Dark Themed XnViewMP 0.99.6 64bit on Win10 x64 -
User avatar
xnview
Author of XnView
Posts: 36812
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Rethinking Tags

Post by xnview »

Ok, i'll change tag for 0.57, and will add albums in a future release
Pierre.