Author Topic: Limit keywords?  (Read 2795 times)

Offline Old timer

  • Member
  • **
  • Posts: 50
    • View Profile
Limit keywords?
« on: January 02, 2017, 02:04:52 PM »
Hi Kirk,
Is it possible to limit keywords?
For instance, 60 words.
Anything above that would be ignored.

Thanks

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Limit keywords?
« Reply #1 on: January 02, 2017, 06:39:58 PM »
Is it possible to limit keywords?
For instance, 60 words.
Anything above that would be ignored.

No, there is no way to limit the number of keywords.

-Kirk

Offline Old timer

  • Member
  • **
  • Posts: 50
    • View Profile
Re: Limit keywords?
« Reply #2 on: January 02, 2017, 11:23:26 PM »
OK, Thanks for the info.
Is there a way to truncate existing keywords?
For instance, 200 existing keywords need to be reduced to 60?

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Limit keywords?
« Reply #3 on: January 03, 2017, 03:17:26 AM »
OK, Thanks for the info.
Is there a way to truncate existing keywords?
For instance, 200 existing keywords need to be reduced to 60?
This is not trivial. For instance, how would you decide which keywords to keep or remove?
If you don't care, what you could do is simply trim the keywords to a maximum string length. For instance you could use the string {keywords:0,200} in the keywords field of the IPTC stationary pad and apply that to your files. This would trim off anything past the 200th character. Note that this will cut off keywords mid word too though and please test before applying this to your files ;)
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline Old timer

  • Member
  • **
  • Posts: 50
    • View Profile
Re: Limit keywords?
« Reply #4 on: January 03, 2017, 09:34:50 AM »
Hi Hayo,
Thanks for helping me again.
Yes, I’m aware it’s best to choose, be careful, methodical et cetera …. but limited time for boring stuff.
In some cases, maybe better to spoil the words than waste life.
Great that the option exists. Will play for a while and see how much damage I can do.

Offline Old timer

  • Member
  • **
  • Posts: 50
    • View Profile
Re: Limit keywords?
« Reply #5 on: January 03, 2017, 09:46:13 AM »
Hayo,
Tested your method, and failed.

My procedure:
{keywords:0,200} IPTC stationary pad in keywords field (with both boxed ticked).
Result = a “D” is added to keywords, but length not reduced (470 characters).

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Limit keywords?
« Reply #6 on: January 03, 2017, 11:58:15 AM »
First of all you shouldn't have ticked the second checkbox as that will append the text you enter in the field. But there's a bigger issue in that my suggestion doesn't work: you can not use the keywords variable to replace itself :(

To get this to work, you need to use two separate goes with the stationary pad.
On a first run you you first need to copy the keywords to a different field (you can strip it at that point already) and then on the second run copy the content from that field back to the keywords field. Not straightforward but it works.

For this kind of exercise I would actually recommend the use of Phil Harvey's exiftool. It's a command-line application with which you can do all sorts of cool and complex metadata manipulations. It too has a forum where you can ask questions :)
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline Old timer

  • Member
  • **
  • Posts: 50
    • View Profile
Re: Limit keywords?
« Reply #7 on: January 03, 2017, 12:24:23 PM »
Hi Hayo,

Did try it with and without ticks.

Have previously looked at EXIF tool, but would prefer a quick fix.

Your explanation about copying to a different field, and then back again sounds reasonable.

Is it possible for you to show the code?

In my case, it would be easy to move the keywords to ‘Special Instructions’ (an unused boy) as step one of the process.

1) How to do that?
2) How to move them back again limiting the characters?

(Obviously, only if you have time for this).

Thank you

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Limit keywords?
« Reply #8 on: January 03, 2017, 01:05:52 PM »
A quick reply, but hopefully enough to get you going.

Step 1: in the IPTC stationary pad set (only!) the special instructions field to the string {keywords:0,200} (or whatever length you want). Apply this stationary to your file(s).

Step 2: open the stationary pad again, clear the check mark for the special instructions field and set the keywords field to the string {specialinstructions} (please look up the exact name of the variable) and apply this again to the same file(s).

That should do it.

Note: the special instructions field might not be able to hold strings of all sizes, so you might need to experiment with a different field.
Hayo Baan - Photography
Web: www.hayobaan.nl