This forum has been archived. All content is frozen. Please use KDE Discuss instead.

searching for image by metadata

Tags: None
(comma "," separated)
tc
Registered Member
Posts
9
Karma
0

searching for image by metadata

Tue Mar 31, 2020 6:18 pm
I have an image file containing a jpeg comment

Code: Select all
$balooshow -x /home/chris/Pictures/knoydart.jpg
663477957953543 2055 154478 /home/chris/Pictures/knoydart.jpg
        Mtime: 1000492265 2001-09-14T19:31:05
        Ctime: 1584895439 2020-03-22T16:43:59
        Cached properties:
                Comment:
Looking south towards Knoydart from Sgurr a'Mhaoraich
                Width: 12422
                Height: 1302

Internal Info
Terms: Mimage Mjpeg T4 Timage X26-12422 X27-1302 X8-a'mhaoraich X8-from X8-knoydart X8-looking X8-sgurr X8-south X8-towards
File Name Terms: Fjpg Fknoydart jpg knoydart
XAttr Terms:
comment: a'mhaoraich from knoydart looking sgurr south towards
height: 1302
width: 12422
$


However, when I try to search for this file by content (in Dolphin) and use sgurr or looking as a search word, nothing is found.
I can find the file by filename.

Should my content search work?
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: searching for image by metadata

Tue Mar 31, 2020 9:05 pm
Hi!

Do you index your file contents?
Code: Select all
balooctl config list contentIndexing
tc
Registered Member
Posts
9
Karma
0

Re: searching for image by metadata

Wed Apr 01, 2020 8:49 am
Code: Select all
$ balooctl config list contentIndexing
yes
$


The documentation I found at
https://community.kde.org/Baloo/Debugging#balooshow
gave me the impression that my file was not excluded and baloo is running
as these were things to check if balooshow had NOT shown my file info.
I hope I am understanding that correctly?

I do also find other files (xml,gpx,pdf) by their content, but not jpg.
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: searching for image by metadata

Wed Apr 01, 2020 11:16 am
Normally it should have been checked by baloo.

You may also have a look at exclude-lists:
Code: Select all
balooctl config list excludeFolders
balooctl config list excludeFilters
balooctl config list excludeMimetypes


If they not include anything your file depends on try to (re)check it manually
Code: Select all
balooctl index /path/to/your/file.jpg
tc
Registered Member
Posts
9
Karma
0

Re: searching for image by metadata

Wed Apr 01, 2020 3:31 pm
I can see no problem with the excludes/filters, and the defaults I have all look sensible.

Code: Select all
$ balooctl index /home/chris/Pictures/knoydart.jpg
Skipping: /home/chris/Pictures/knoydart.jpg Reason: Already indexed
File(s) indexed
$


So I think the index is probably ok, and I am doing something wrong with Dolphin search
or something is wrong with the Dolphin search but I have no idea how to start investigating that.

I don't have a problem with searching in other file types by content so I think I am using Dolphin OK.

I wish I knew whether the balooshow command shows data from the index or from the file. That might clear up whether the index is OK.
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: searching for image by metadata

Wed Apr 01, 2020 4:30 pm
Try direct search with baloo to test it
Code: Select all
baloosearch Mhaoraich


Does this match your file?
tc
Registered Member
Posts
9
Karma
0

Re: searching for image by metadata

Thu Apr 02, 2020 7:59 am
Code: Select all
$ baloosearch Mhaoraich
/home/chris/keep/Hill-bagging_log.gpx
Elapsed: 57.4815 msecs
$


No, the jpeg is not found. Another gpx file which also contains the name of this hill is found.
But on the other hand, this search does find the file.

Code: Select all
$ baloosearch "width>=12000"
/backup/pictures/2012-01-Troutbeck/72-79.jpg
/backup/pictures/2011-07-MidWales/47-53clip.jpg
/backup/pictures/2011-07-MidWales/69-71r.jpg
/backup/pictures/2011-07-MidWales/47-53.jpg
/backup/pictures/2011-05-CarraigThura/AnCaistealPano.jpg
/backup/pictures/2011-05-CarraigThura/p2.jpg
/backup/pictures/2011-04-Patterdale/birkett_panorama.png
/backup/pictures/2010-04-TomichScotland/sum2.jpg
/backup/pictures/2010-04-TomichScotland/sum2trim.jpg
/backup/pictures/slidescan/FranzJoseph/FranzJoseph.jpg
/home/chris/Pictures/knoydart.jpg
/backup/pictures/2001-06-Knoydart/panorama.jpg
Elapsed: 0.50471 msecs
$
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: searching for image by metadata

Thu Apr 02, 2020 9:32 am
Okay. So baloo did not recognize this meta-stuff.

As I have no idea handling photos, so I would try to compare this special file with another one being found to get the difference.
Code: Select all
file /the/file/recognized
#and
file /the/file/not/found


Perhaps the ImageMagick-tools could help you with this.
tc
Registered Member
Posts
9
Karma
0

Re: searching for image by metadata

Thu Apr 02, 2020 11:18 am
thank you for trying for me - the file I showed was an example - I can't get this to work for any jpeg file
it seemed from the balooshow command that it should have done. I intend to install recoll to give it a try next.

As I find myself with some time on my hands I will continue to try and work out (what is wrong with / what I am getting wrong with) baloo.
I have never worked with C++ and have not used C for about 20 years, so I do not expect this to be quick :-)

again - thank you
vielen dank!
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: searching for image by metadata

Thu Apr 02, 2020 2:24 pm
There is no need to use C/C++. The `file` command is a tool located in /usr/bin/file, not a file-descriptor like FILE* in C :)

Can you tell me how you set your meta-tags? I could try it on my machines and see if it is a baloo-bug or a meta-issue.

With the above mentioned imagemagick-pakcage installed it would be
Code: Select all
identify -verbose /file/not/properly/indexed
identify -verbose /file/properly/indexed

(it is really one - before verbose-command)
tc
Registered Member
Posts
9
Karma
0

Re: searching for image by metadata

Fri Apr 03, 2020 9:23 am
I should have been more clear. I only have not properly indexed image files. I have no image file for which this works.

Code: Select all
$ file Pictures/knoydart.jpg
Pictures/knoydart.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 800x800, segment length 16, comment: "Looking south towards Knoydart from Sgurr a'Mhaoraich", baseline, precision 8, 12422x1302, components 3
$


I have now tried recoll and it worked (out of the box).

Here is some background in case seeing what I am trying to do helps.
I actually added the comment 10 ish years ago and do not remember which photo viewing program I used. It would have been something that came with Mandriva back then. Currently I am planning to use exiftool. About 10 years ago, one of the photo viewing programs allowed a comment to be added to a jpeg and would show it to you as you viewed the picture. I added jpeg comments to the next couple of years photos as I took them. With software updates over the passing years, I can no longer find exactly this function in any of the photo viewing programs. They currently save comments to a variety of different places with different software: separate files for each photo, file extended attributes (xattr), EXIF data, etc.

I wish to have the comment in the file so they copy around together, so separate files and xattr are out, as the data could easily get lost copying over fat formated memory sticks, NFS etc. So the jpeg comment would work as woult EXIF as it too is embedded in the file. The various image viewing programs all vary so I can see no obvious preference there. Next I looked at desktop indexing to see if one thing worked better than another. I use KDE so I started with baloo, to find that I could not get it to work at all.

My wife says 'forget all this useless software, lets just put the comments in a spreadsheet'. Obviously to search the photos you then need to open the spreadsheet, search it and then go and find the matching file. Not great but unlikely to go wrong. I quite like this solution as exiftool can import from and export to a spreadsheet (via csv files). Now I can use the spreadsheet to update the comments in the files, and recreate the spreadsheet from the files. And recoll works to search directly.

As a software developer (long retired), however, I want to understand why I couldn't get baloo to work for me. And if possible, get it to work, even if I have to read code and learn new languages.

So if you wish to continue helping me, that would be great. The problem for me has moved from how do I index my pictures. It is now how do I get baloo to do it so I dont need recoll.

here is a simple way to add a comment to a jpeg file

Code: Select all
$ exiftool -comment="here is an example comment" knoydart2.jpg
    1 image files updated
$


This will rename the original file adding _original to the name, and write out a new file.

and finally

Code: Select all
$ identify -verbose knoydart.jpg
Image: knoydart.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Mime type: image/jpeg
  Class: DirectClass
  Geometry: 12422x1302+0+0
  Resolution: 800x800
  Print size: 15.5275x1.6275
  Units: PixelsPerInch
  Colorspace: sRGB
  Type: TrueColor
  Base type: Undefined
  Endianess: Undefined
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
    Pixels: 16173444
    Red:
      min: 0  (0)
      max: 255 (1)
      mean: 143.237 (0.561712)
      standard deviation: 66.2298 (0.259725)
      kurtosis: -1.06177
      skewness: 0.162137
      entropy: 0.954381
    Green:
      min: 0  (0)
      max: 255 (1)
      mean: 136.436 (0.535041)
      standard deviation: 69.2424 (0.271539)
      kurtosis: -1.18
      skewness: 0.233636
      entropy: 0.950578
    Blue:
      min: 0  (0)
      max: 255 (1)
      mean: 132.856 (0.521005)
      standard deviation: 77.177 (0.302655)
      kurtosis: -1.34835
      skewness: 0.159589
      entropy: 0.965431
  Image statistics:
    Overall:
      min: 0  (0)
      max: 255 (1)
      mean: 137.509 (0.539253)
      standard deviation: 70.8831 (0.277973)
      kurtosis: -1.19629
      skewness: 0.161752
      entropy: 0.956797
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 12422x1302+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 75
  Orientation: Undefined
  Properties:
    comment: Looking south towards Knoydart from Sgurr a'Mhaoraich
    date:create: 2020-04-02T14:07:38+00:00
    date:modify: 2001-09-14T18:31:05+00:00
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: f709ffd2b0ef42ef7703f3d927a49a33944e6ab119fd4bcd5536dd8e4b560684
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 1.36696MiB
  Number pixels: 16.1734M
  Pixels per second: 97.5328MP
  User time: 0.160u
  Elapsed time: 0:01.165
  Version: ImageMagick 7.0.8-62 Q16 x86_64 2019-08-30 https://imagemagick.org
$
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
I'm not a developer, unfortunately, but I'm interested and have a basic knowlegde of some languages. As I'm using baloo as my file indexer too (including contents), being interested in making it better, so perhaps we can find a way to get closer.

Thank you for your input, I'll create a test environment this weekend and search the known bugs!

// what I forgot:
Searching works only if you make it explicit:
Code: Select all
exiftool -Comment=ExifToolComment testpic.jpg
baloosearch "Comment=ExifToolComment"  # → does work


So it seems not to be the indexer but the query search included stuff.
tc
Registered Member
Posts
9
Karma
0

Re: searching for image by metadata

Fri Apr 03, 2020 2:40 pm
thank you
that is very helpful

Code: Select all
$ baloosearch "Comment=a'mhaoraich"
/home/chris/Pictures/knoydart.jpg
Elapsed: 0.289837 msecs
$


so now I can concentrate my effort on what the search in Dolphin does :-)
tc
Registered Member
Posts
9
Karma
0

Re: searching for image by metadata

Fri Apr 03, 2020 2:55 pm
and if I put

Code: Select all
comment=a'mhaoraich


into the Dolphin search box where I thought I just needed to put the search terms, that too works
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: searching for image by metadata

Fri Apr 03, 2020 5:08 pm
It helps, but it is not the way I exptected it to work. As I'm using arch I have to compile baloo with debug-flags to get more information (or use a virtual machine with debian/ubuntu and dgb-packages).

I'm also missing a manpage which describes what baloosearch -type XX does.


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]