BestImageViewer / geeqie

claiming to be the best image viewer / photo collection browser
http://www.geeqie.org/
GNU General Public License v2.0
476 stars 78 forks source link

Feature-Request: Make special JPEG comment (COM) available for, for example, overlays #381

Closed ghost closed 7 years ago

ghost commented 8 years ago

I’d like to have it shown, but there’s no %keyword%.

mowgli commented 8 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512

Hi,

Am Mo den 2. Mai 2016 um 5:25 schrieb deterenkelt:

I???d like to have it shown, but there???s no %keyword%.

Well, there is a %comment% to display the comment as you ask for in title. There is even a %keywords% to display keywords as you ask for in the text above.

If that is not enough, try to implement what you want via %lua/.../% or %lua//...%. However, this is somehow underdocumented currently. The first call the lua script under ~/.config/geeqie/lua/....lua and the second a plain lua function. There you should have full access to all exif values.

For example, I use the following lua script in overlay:

exif = Image:get_exif();
mydate = Image:get_date();
mysource = "F";
exifdate1 = exif:get_datum("Exif.Photo.DateTimeOriginal");
if (exifdate1) then
   mydate = exifdate1;
   mysource = "EP";
end
return os.date(mysource .. ": %c", mydate);

Regards Klaus


Klaus Ethgen http://www.ethgen.ch/ pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen Klaus@Ethgen.ch Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Charset: ISO-8859-1

iQGcBAEBCgAGBQJXKba3AAoJEKZ8CrGAGfasufkL+wV8yx/WDuXaEwGz5Wiia+wL rtDk06TrrtQH/CJpDXdxgZtg4x5zA+5Um7vDxgb2hNKNsZsDrTu2m7icRcq4kQiu v34+4Fvv7K8gOEa1wAdJGKzgjUt/QITbu+DrioV3kJL2DlHu5XNTjMiy9hvydfeS 608QO+4XOdyYPMCSmss1+KJg5emiPswensYfSxmaKptmuL9c2FpA5RRl9XM7zT9s emtS1yalP7u9huokWv2aEcP9KUe1gfadA12AlGPlKMjuAskhYUCaPZ6idLuearpK aLhyfMAdqIxIfHKh1n95DkNA5hbM6EkTpCk3C2hU266oA8BBx28u7tRZoVLeC8KL Wbz5FjLp4hKwLbfv6mssrkSfKBvPtC9pqoua4h8boOMe5OscbeuQG4SYFkGQMDbj xFRLJuxvRFs1qpDbJq8LW7Mkgzvl9b+grxKWK4NPMxj8JHy/gTg1kHNDLwpj7FFt XccRO/CEO9rQ/6/KgWWm/Tjk+R411KmLEOSrqC5qLA== =ho8n -----END PGP SIGNATURE-----

ghost commented 8 years ago

Can you see the internal comment in this image using %comment%? this image For me it returns only an empty string.

GIMP sees it sees it as well as imagemagick

$ identify -format %c ~/desktop/1358913557.jpg 
Look, a tiny triangle snowflake.

while Geeqie does not. 1462352355

mowgli commented 8 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512

Am Mi den 4. Mai 2016 um 10:09 schrieb deterenkelt:

Can you see the internal comment in this image using %comment%? this image

Well, it is using the comment that is also displayed in the side bar. Exif supports different comments. If you want to support all, you have to use the lua hook as I described. You can find the exif name with ctrl-e.

Gruß Klaus


Klaus Ethgen http://www.ethgen.ch/ pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen Klaus@Ethgen.ch Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Charset: ISO-8859-1

iQGcBAEBCgAGBQJXKdG3AAoJEKZ8CrGAGfaslpcL/i/aPA77jso9VhJqaGh+AMXL mTw3FypDMwQ9IR10S+cxgz8sqNBQv3OQZ5ub1RFaPEpnRn6+YV99HBp7C0KemhIS MmgwDfazLbZYpzom3kZ84a2TLQVuLqVv1rom8TrEr56X60ePx+pfxcoIEtvmHFVA EeazdAAeOnisIsw5jYz8Ahbdvp1sNYOLdw9xDgMbGt3oKsuVT5WIhAmpX/Ypno+y 0eAg1n2kAtB0OYIwhylLuKPg0+4gnbroqol0qN1AHZK9NFhp1bDPPL9ti7quZ0NY aE2rbv1Ega1LJUVyFEnPag5GXGgXghSi9QebGeoZkk4/0Sbg9MYJELEQUH43r55+ apt4neWYPw+v973Ya9ymRs3TCDoUo09dAtfEp8IJx0XwRMkrQ1FhIeXsxnJN/bmn B3zoyR4Ji9XsdrUn+vUXgIW8iGkijrb+qND7rKiGCHmZU5BLM93ueGaRrRzPXoRS dcnWY1PrlJfGVmKCMTl1oY+1poG3SVPC+i+LB4g8lQ== =uDu8 -----END PGP SIGNATURE-----

ghost commented 8 years ago

You can find the exif name with ctrl-e.

Exif drop-down is grayed, and, though I can open/close it, it’s empty. Looks like geeqie was compiled without EXIF support, but it definitely was compiled with exif: 1462358994

mowgli commented 8 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512

By the way, geeqie uses exiv2 library to get exif informations. You can look via exiv2 commandline tool what tags are seen.

Your image uses an comment-tag that is rather unusual. Exiv2 does not see it.

If you want to look at how many ways there are to specify comments, look into the list of exiftool (man Image::ExifTool::TagNames) and search for "Comment". There is really nothing that geeqie can do about. You can write a bug report for exiv2 or use more common comment tag (for example that, geeqie write).

Regards Klaus


Klaus Ethgen http://www.ethgen.ch/ pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen Klaus@Ethgen.ch Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Charset: ISO-8859-1

iQGcBAEBCgAGBQJXKdWCAAoJEKZ8CrGAGfasHMcL/R6/OgiUyGcIZ2euVGQ86s2H iKjZeKoAoQGlAqSqXX9eOTSxefpxoyLk4zLAuZJFfdX2jJMbC5024cjtNboaAm9O ba6jPyzy0qJewr5cAASaxZ61tjuG322VNrBFAz7DYGiPMshe2ympqyOCJZ2cb9Kb H4wGeJZXggjuxlOrBtc4lRt3oPXvRE9VtwTdn2qPrt2cQp45U8LI9guz31aVWFzw s5yvsYtbT88vU9vQobqS9Z/YJJrmL+rfACYDBC3S82gKRAPl50SSoe9o3m9hhbbH sOIcIOXV4SscFu6ulpx6/zU4/g9DJQXo4yugK7kKpyLDDDSRBq+le2NgRjNVxYbQ HHbaXaInzHZ0iT1HSTFyCtmlnDGAhI7rbXbWQI0Moxpzfsm+CKUhvFf8g8gZyONj BH1YzR9F4fb0ziujGwJcr4FlobtOPla2JrtY4ka6Ou5pUYJ23/SpEmTI6jODHQnc cNqWhFQ+6V6//5I7pP7nclDRhShOHePikma0+SqiEg== =UB3g -----END PGP SIGNATURE-----

mowgli commented 8 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512

Am Mi den 4. Mai 2016 um 11:50 schrieb deterenkelt:

You can find the exif name with ctrl-e. Exif drop-down is grayed, and, though I can open/close it, it???s empty. Looks like geeqie was compiled without EXIF support, but it definitely was: 1462358994

I do not know what that "equery" command does.

But first, the comment is in a section that exiv2 does not see and second, "exif"-Support, meaning the ols exif-Support in geeqie is long deprecated. The used library for years now is exiv2.

Regards Klaus


Klaus Ethgen http://www.ethgen.ch/ pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen Klaus@Ethgen.ch Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Charset: ISO-8859-1

iQGcBAEBCgAGBQJXKdZqAAoJEKZ8CrGAGfasDTcL/1GdYTMJr2Dk0BUIMCIOP3Tj 7BYaaSJ0aKcxUAh6PBr7Wn4e8k77kvHf3EbPDDdj0qJgOExmrVWm0MUlf38H9Ylm HNN17sKywJ3qysLPSY7kH0GcJkHE/WE6lb4O4LEW6cOiKxlxfcORXWCH6txmZl3S HtVnswkr+HZfmwBx/WJZe5UdDRLW6UTQsbyGVZTgHG19/HBm8+kJcru2K6nPp8K5 3elAxqscM7mbAv1qMhVGdH+PD7sR8OCf+kw5OedzU7k1V3cyyuvafQZlOBU/ZfHl W8uRGrrh2YblOqnl2wnJJ3NGCsiCVcOteMqOPjdoiyQmgdgTOp4bqdaMIW/JYtkz stoDqOO4/qIwEgcGtlaZuKVPOK2gcB1LlDcoXI86YfLjaUVnLiN9fu8GY2v6BcVk ANFA4scUhCmnkWLl1ncDVDNrOChyKP4hXBV/lbOzKUM0motwcN3nP5N/VeeyWBZ2 /Wecpwia7w9V9lLy5SIuCkaYoWErJsMucv1TtaKyHg== =0bCC -----END PGP SIGNATURE-----

ghost commented 8 years ago

By the way, geeqie uses exiv2 library to get exif informations. You can look via exiv2 commandline tool what tags are seen. Your image uses an comment-tag that is rather unusual. Exiv2 does not see it.

$ exiv2 -p c  ~/desktop/1358913557.jpg
Look, a tiny triangle snowflake.
$ exiv2 --version
exiv2 0.25 001900 (64 bit build)

If you want to look at how many ways there are to specify comments

Sorry, but I, as a user, want to specify comments in my preferred image editor, GIMP in our case, and see the comments, that people put in images in my viewer.

I do not know what that "equery" command does.

There was a legend in the output, it states that equery prints which USE flags are enabled in configuration for the package in question and with which flags that package was actually built, i.e. how settings correlate with what’s on hand.

But first, the comment is in a section that exiv2 does not see and second, "exif"-Support, meaning the ols exif-Support in geeqie is long deprecated. The used library for years now is exiv2.

I’ve checked the ebuild file, USE flag exif, if set, translates to --enable-exiv2 configure option.

if use exif || use xmp; then
    myconf="${myconf} --enable-exiv2"
else
    myconf="${myconf} --disable-exiv2"
fi
mowgli commented 8 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512

Hi,

Am Mi den 4. Mai 2016 um 12:27 schrieb deterenkelt:

By the way, geeqie uses exiv2 library to get exif informations. You can look via exiv2 commandline tool what tags are seen. Your image uses an comment-tag that is rather unusual. Exiv2 does not see it.

$ exiv2 -p c  ~/desktop/1358913557.jpg
Look, a tiny triangle snowflake.
$ exiv2 --version
exiv2 0.25 001900 (64 bit build)

Right, it does show it only with explicite "-p c".

If you want to look at how many ways there are to specify comments

Sorry, but I, as a user, want to specify comments in my preferred image editor, GIMP in our case, and see the comments, that people put in images in my viewer.

I believe that this could be frustrating from user perspective. But from the amount of tags where you can find a comment it is nearly impossible to match all use cases.

With the same argument you can create a bug report for that other tool the "people" use.

I do not know what that "equery" command does.

There was a legend in the output, it states that equery prints which USE flags are enabled in configuration for the package in question and with which flags that package was actually built, i.e. how settings correlate with what???s on hand.

Yes, but as I described, that is not useful information for the fact that we does not use exif than exiv2 support in geeqie.

But first, the comment is in a section that exiv2 does not see and second, "exif"-Support, meaning the ols exif-Support in geeqie is long deprecated. The used library for years now is exiv2.

I???ve checked the ebuild file, USE flag exif, if set, translates to --enable-exiv2 configure option.

if use exif || use xmp; then
    myconf="${myconf} --enable-exiv2"
else
    myconf="${myconf} --disable-exiv2"
fi

Ebuild sounds like gentoo, right?

Even though, when you enabled it and see no informations with ctrl-e there might be some compiling problem or your compilation used older libraries or something like that.

Geeqie is orientated at exif and xmp. So maybe you want to migrate that comment to a UserComment there. Sorry, currently I cannot give you another answer. Even if we implement a special solution for that (remember, that is only valid for JPEG as it is no compatible tag for other image formats), I believe that there will be other tags that others miss. It is fair to ask for implementing of that tags. Even better to come up with a patch. But as you might be able to extract the information with the lua tag (you need to compile the respective support into geeqie), there is no pressure to push that into geeqie itself. Lua support was implemented exactly for this purpose; to allow special informations coming from other sources than geeqie knows. Maybe [0] is of help.

Regards Klaus

[0] https://github.com/luapower/libjpeg


Klaus Ethgen http://www.ethgen.ch/ pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen Klaus@Ethgen.ch Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Charset: ISO-8859-1

iQGcBAEBCgAGBQJXKeOmAAoJEKZ8CrGAGfas8kYL/0CDAYsXqUhVMVkwRVhoo8QA B4kvdIqfCvrtpVPn3uKMs69kxaeLXRqEj5BRe/FcorArWEBd2rHKrApQ4sb7QWif EAiY7zhgRQRSb2MPhUEz805xhh3dgnh44OkwWyAjJPnhWrRsqOdeD4Qwnf2LJXna fCEhs6DUikkSUTvyer670IdmaHUm+3G833bLQHZBho+M2JhPSpBdxGqpQeBG/c1Z iwnFACp2DRB46+Aue18Tznc6ji6tdpiyGOlIBFTJjkJkxx7P2TT5Gvf1I6RdJ4F+ vMip3V308QWP+kbVYxgtAI3O3tE0gJ85dgMAO4pEqG9YSpY2XkTM6qbgkSDmfgr0 hGUK6NghXavRI8Wy90tsfkJlSLuFxB0p29eh5JMUJFxQ+/f+Ny78HF7adO58tSsd aNNHO7BtjsJKPzXCRm4QzF2UbM9MypQkaHTL+YxXYRvRT4R1nG66V60EM4yCC14v d/M3pWxbL4u/TrGNYHRau/g2RyJCb3pNEUw/FUoj6g== =NlgR -----END PGP SIGNATURE-----

mowgli commented 8 years ago

Reopening and tag it as feature request for JPEG COM comment as a tag.

lge commented 8 years ago

On Wed, May 04, 2016 at 04:27:29AM -0700, deterenkelt wrote:

By the way, geeqie uses exiv2 library to get exif informations. You can look via exiv2 commandline tool what tags are seen. Your image uses an comment-tag that is rather unusual. Exiv2 does not see it.

$ exiv2 -p c  ~/desktop/1358913557.jpg
Look, a tiny triangle snowflake.

Right. So this is NOT an exif or xmp comment. But a JPEG comment.

yes, that would be available in libexiv2 in (pseudo code) Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_) image->readMetadata() image->comment()

Klaus, maybe you can give an example how to get at that value using lua?

Other than that, maybe someone can add a check on image mime type jpeg, and (also? optionally?) print the jpeg comment for %comment%, or add a %jpegcomment% ?

As of now, %comment% will only look at "Xmp.dc.description"

Lars
ghost commented 8 years ago

I believe that this could be frustrating from user perspective.

Of course, that is! I often download images from a certain resource, which uses that same JPEG COM to put text in it, and it’s frustrating when later I can’t read the description in the viewer.

With the same argument you can create a bug report for that other tool the "people" use.

I cannot know what other ‘people’ use. I do not contact them.

Ebuild sounds like gentoo, right?

You guessed right.

Even though, when you enabled it and see no informations with ctrl-e there might be some compiling problem or your compilation used older libraries or something like that.

I didn’t change geeqie flags since the last time it was compiled. equery output proves that.

Reopening and tag it as feature request for JPEG COM comment as a tag.

Thanks.

mowgli commented 8 years ago

Klaus, maybe you can give an example how to get at that value using lua?

I did give an lua example above that I use myself. Further on, one can use any lua construct there. I did not made further research into the libjpeg stuff. There might be even another way in lua.

However, that lua stuff needs to be better documented. :-D

caclark commented 8 years ago

Hi Klaus et al The problem being discussed here (jpeg Comment, not exif Comment) I encountered a while ago - after much headache I couldn't solve it, and forgot about it.

I loaded Lua for the first time today. It provides trivial answer to the problem. Here is the Lua script:

-- Retrieve the jpeg comment of a file path=Image:get_path() commentfile=io.popen("exiv2 -p c \"" .. path .. "\"" ) comment = commentfile:read("*a") commentfile:close() return (comment)

I have not read the Lua documentation, so this script will be in the range of good, bad, or just plain ugly.


I will write a brief section in the Help file on Lua - just basic info.

Are the only dependencies liblua5.1-0 and liblua5.1-0-dev? (Isn't Ubuntu using 5.3?) If Lua is installed, geeqie config/make will automatically compile in whatever is necessary? Is ~/.config/geeqie/lua the default folder, or the only folder? If the default, how are other folders accessed by geeqie-lua? All Lua scripts must have the extension .lua, lower-case? Are the 6 image functions listed at line 180 of lua.c the only ones geeqie-lua provides? Is Image Overlay the only place Lua scripts can be used in geeqie? Anything else?

Thanks

Colin...

mowgli commented 8 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512

Am Mi den 4. Mai 2016 um 18:14 schrieb caclark:

I loaded Lua for the first time today. It provides trivial answer to the problem. Here is the Lua script:

-- Retrieve the jpeg comment of a file path=Image:get_path() commentfile=io.popen("exiv2 -p c \"" .. path .. "\"" ) comment = commentfile:read("*a") commentfile:close() return (comment)

I have not read the Lua documentation, so this script will be in the range of good, bad, or just plain ugly.

Thanks, I will include that script in the upcoming lua documentation. :-)

I will write a brief section in the Help file on Lua - just basic info.

  • if Klaus could confirm some data.

Are the only dependencies liblua5.1-0 and liblua5.1-0-dev? (Isn't Ubuntu using 5.3?)

yes, liblua5.1-0-dev which has the other as dependency.

If Lua is installed, geeqie config/make will automatically compile in whatever is necessary?

Yes. if ./configure is run.

Is ~/.config/geeqie/lua the default folder, or the only folder? If the default, how are other folders accessed by geeqie-lua?

Currently it is the only one. There is also no way actually to change that via options or else.

All Lua scripts must have the extension .lua, lower-case?

Well, geeqie does not care about that but it should keep that extension to, for example, allow your editor to highlight it proper.

Are the 6 image functions listed at line 180 of lua.c the only ones geeqie-lua provides?

Yes. Currently. That will be extended to the needs in future.

Note that for example get_exif gives full access to exif data.

Is Image Overlay the only place Lua scripts can be used in geeqie?

Currently yes but I have the idea to extend it to other places.

Ideas are:

Anything else?

The first implementation (as it is done today) I had the special use of overlays in mind. But I had always in mind to extend it with use cases.

Unfortunately, I did not document it proper until now. :-D

Regards Klaus


Klaus Ethgen http://www.ethgen.ch/ pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen Klaus@Ethgen.ch Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Charset: ISO-8859-1

iQGcBAEBCgAGBQJXKjKiAAoJEKZ8CrGAGfas+oAL/22k0btS0jxHtlNzVl2r7l0J 2QkCR9Y6AJdNNf7PJfrI8Z9pcyaJnC9KIYgjfiAXnYwkLEHn5ILdXsbjyI3WSYkQ 6NucgM1ahx6nIBdSZjz05Mr/9ElbCUEwGeIhpil5FdUtKfJQAqgCUmRJlylI+tZh 2sU5k7FKGfvOpgRnPy2B/7l2Qde7NopxjjAzPu8auebcKEUAAAnPk9apq6Gv2mdj +zokCpNMyzV9B4BNwbbXSCv7age4M6BOAhouTI/PilI1AapdPmXwD8Mn4VyJyGof YB81j+KoTAfi17gg+cjDXr3swFKxnrrHBF3QZzinNDyqk8O5kIqJZf7FbhrQBbKM IjQ9y1xCJixWGfdeAky43hnJRbWP2DIHzHlmm8eFPaqUH2DnMAKOHS3nSlLuukNF G6/0oK8K1dqI6SnZSbv2vjfufBKdoUX1VdWDKTAcIziUG3PLgaljSTYjiZXg4i5k 6mdNRZvThgCMCBjLQVs0Q0aveVT7cPwyPVqWwAQPbQ== =rCVn -----END PGP SIGNATURE-----

AlexanderAntimonov commented 7 years ago

Here is a patch with support for reading JPEG comment: 0001-Issue-381-Make-special-JPEG-comment-COM-available.patch.zip

Can be seen in the overlay with "%imagecomment%" keyword. geeqie-with-jpeg-comment

ghost commented 7 years ago

Thanks, Alexander, it works with geeqie-1.3-r1!

caclark commented 7 years ago

Alexander Antimonov's patch included in commit 50f5ef3ced at geeqie.org