Image Kimdaba

From KDE Wiki Sandbox
Revision as of 12:02, 21 November 2010 by Claus chr (talk | contribs) (Importing a new version from external source)

Generel beskrivelse

Image::Kimdaba er et perl-modul tilgængeligt fra CPAN til at læse KPhotoAlbums database

Installation

Her vil vi antage, at du vil installere modulet som bruger, for eksempel i $HOME/local;

$ mkdir -p ~/local/bin
$ perl -MCPAN -e shell

Svar på en bunke spørgsmål første gang. På et tidspunkt skal du skrive

PREFIX=~/local

Skriv så i CPAN-skallen

> install Image::Kimdaba

Du skal modificere to miljøvariable (ret versionsnummeret til, så det passer):

export PERL5LIB=~/local/lib/perl5/site_perl/5.8.3:~/local/lib/perl5/5.8.3
export PATH="$HOME/local/bin:$PATH"

Hvis alt er i orden, så er det tid til at teste om det virker. Start kimdabas demo (i menuen Hjælp) og kør:

$ kim_example.pl  /tmp/kimdaba-demo-$USER


Opgradering

Takket være CPAN's infrastruktur skal du blot skrive

$ perl -MCPAN -e 'install Image::Kimdaba'

Installation på Debian

På Debian er det muligt at installere Image::Kimdaba automagisk. Installér først dh-make-perl og så (som root)

# dh-make-perl  --build --install --cpan Image::Kimdaba

Scripter, som følger med Image::Kimdaba

Note
README-filen på CPAN er måske mere up to date.


Her beskriver vi allerede eksisterende scripter, som kan være nyttige.

Synkronisér kommentarer mellem Kimdaba og digiKam

Første gang skriver du

$ ./kim_2_digikam <rootfolder>

hvilket vil lave databasen digikam.db, som bruges af digiKam (>= 0.7 og < 0.8 )

Start kimdaba, lav nogle ændringer og genstart scriptet

$ ./kim_2_digikam <rootfolder>

hvilket vil opdatere databasen digikam.db (du skal dog genstarte digiKam for at se ændringerne).

Føj nogle kategorier til nogle billeder i digiKam og genstart scriptet

$ ./kim_2_digikam <rootfolder>

Nu kan du importere de ændringer, som du lavede i digiKam ved i 'Kimdaba at vælge Fil -> Importér: /tmp/digikam_export.kim

Fordelen ved at synkronisere med digikam.db er, at du så kan bruge en KIOSlave, digikamtags:/, til at browse efter personer, nøgleord eller steder i ethvert KDE-program. (Og føj for eksempel et faneblad "Kimdaba" -> url=digikamtags:/ i Konquerors sidepanel for eksempel).

Eksport af JAlbum-gallerier

Hvis du godt kan lide de mange flotte måder, som JAlbum lader dig vise dine billerder på, men ikke ønsker at opgive KPhotoAlbum, så brug dette script til at tape dine kommentarer fra Kimdaba på JAlbum.

  • Download kim_jalbum.pl herfra, og skriv:
$ ./kim_jalbum.pl <rootfolder>

Download så JAlbum og installér det (kræver Java). Du skal først opsætte nogle ting:

Fanebladet main:

Image directory: Kimdabas rodmappe
Output directory: Mappen, hvor dit album ligger
  • Tab advanced:
Ignore pattern: \..*|ThumbNails|CategoryImages|index.xml
  • Menu File -> Save as default

JAlbum only allows you to make a gallery from one folder (and its subfolders) while KPhotoAlbum does not have this restriction. Here is a solution:

In Kimdaba

  • Eventually delete the "jalbum" keyword to restart from scratch.
  • Set the "jalbum" keyword for each pictures you want to export.
  • Save your changes

In Konsole

Create a directory with symlinks to your tagged pictures :

$ kim_jalbum.pl ~/Images --exportdir ~/Syms/patou/

That's it, now use ~/Syms/patou/ as Image Directory

Auto-assign categoryimages

In Kimdaba's browser, you can see the list of the persons on your pictures by name, or by icons. In the viewer, you can assign an icon for a person of the pictures by Right click -> Show category editor, but it's a bit long if you have 500 persons. So this script will choose it for you.

$ mkdir -p <rootfolder>/CategoryImages
$ ./kim_category_images  <rootfolder>

It's faster than to set the 500 pictures by hand, isn't it? You can still use the category editor to choose a better picture for this person or that keyword, the script will not overwrite it.

Really rotate your pictures

In KPhotoAlbum, you can rotate pictures, but the pictures will not be really rotated, the rotation will only be stored in the index.xml database. To improve interoperability with other software, it's useful to really rotate. Quit Kimdaba and use this script (you need the jpegtran tool)

$ ./kim_rotate.pl <rootfolder>


Export a hierarchy of symbolic links

(This is a bit proof-of-concept for Kimdaba.pm, but could be useful when using non kde apps (see kim_2_digikam ))

Edit the first line of the script, then

$ ./kim_2_filesystem <rootfolder>

Write your own

If you need to export your comments in another format, or you want to do some fun thing not available with Kimdaba and you know a bit of Perl, you can Write your own extension , it's very easy.

If you feel the need, you can share your script with other people by editing this page and sending an email to the KPhotoAlbum mailing-list.