Author Topic: Bulk caption edit  (Read 7416 times)

Offline foyle3

  • Member
  • **
  • Posts: 53
    • View Profile
Bulk caption edit
« on: October 25, 2017, 02:50:14 PM »
My own fault I know.  In error I have added a set of terms in the caption field of hundreds (maybe 1000s) of photographs across dozens of folders and sub-folders.  All with the best of intentions but additional terms were hidden out of sight in the field box.  I know what the unwanted terms are.  First line of every caption is the true description of the picture for searching - BUT - the rogue terms throw up false positive results so searching takes an age with literally hundreds of wrong results.  Anyone know of a way within Photo Mech or another programme where I could apply Find/ Replace across multiple files in multiple folders.  The manual method is likely to take weeks.  See you all around Xmas maybe

Offline Jerry H

  • Camera Bits Staff
  • Full Member
  • *****
  • Posts: 229
    • View Profile
    • Camera Bits, Inc.
Re: Bulk caption edit
« Reply #1 on: October 25, 2017, 04:02:46 PM »
If the information you're replacing is the same for all files, you can use the Find and Replace to remove the text. You can open multiple folders into one Contact Sheet by right-clicking on the parent folder from within Photo Mechanic's Navigator panel and choosing "Open Folder and Subfolders in new Contact Sheet". If there is no common parent folder, the you will need to right-click on each image folder from within Photo Mechanic's Navigator and choose "Open in current Contact Sheet". Then use Photo Mechanic's Find and Replace (Edit menu) utility to remove the unwanted caption text. In the Find and Replace dialog, make sure the box is checked to search in the IPTC data and that only the Description/Caption box is checked.

HTH

-Jerry

Offline foyle3

  • Member
  • **
  • Posts: 53
    • View Profile
Re: Bulk caption edit
« Reply #2 on: October 26, 2017, 02:00:23 AM »
Brilliant - eyes burning staring at monitor.  Didn't know multi selection was possible.  Allelu

Offline foyle3

  • Member
  • **
  • Posts: 53
    • View Profile
Re: Bulk caption edit
« Reply #3 on: October 26, 2017, 03:53:06 AM »
So far but no further I fear.  I am not being offered the "Open Folder and subfolders in new contact sheet" or "Open in current contact sheet".  Only option is "open in new contact sheet" .  Possibly because I am still using PM 4.6.9 ?  and very happy with that version I have to say - retired now so no impelling need for faster, bigger etc - until perhaps NOW ?   Cheers

Offline foyle3

  • Member
  • **
  • Posts: 53
    • View Profile
Re: Bulk caption edit
« Reply #4 on: October 26, 2017, 04:53:38 AM »
Apologies - brain engaged eventually.  I have now found a whole new way of opening folders I didn't know existed.  At my age to learn new stuff - great.  Now deep breath and ... almost certainly learn a whole lot more.  Thanks for patience and very prompt support. 

Offline foyle3

  • Member
  • **
  • Posts: 53
    • View Profile
Re: Bulk caption edit
« Reply #5 on: October 27, 2017, 02:51:17 AM »
Find/replace is working well but another step to a complete solution needed.  I am having to enter each of 33 words or phrases individually into the FIND box - wait for REPLACE completion and enter next.  Tried to enter multiple phrases in FIND box without reliable results.  Is there a character limit and is there a default delimiter such as comma or oblique?  All the terms saved as plain text with spaces does not work. Only one term is entered if there is a RETURN space.  I would really love to be able to enter all (or substantial amount) of search terms and go to bed.  If this is not possible I'll take it as my penance for being stoopid in the first place.  Life without PM unthinkable.

Offline Bob Russell

  • Camera Bits Staff
  • Sr. Member
  • *****
  • Posts: 250
    • View Profile
    • Camera Bits, Inc.
Re: Bulk caption edit
« Reply #6 on: October 27, 2017, 01:44:55 PM »
  The Export Text utility from the File menu's Export option, might be able to help you with this task. This will generate a tab delimited text file from the selected group of images, using the variables of your choice. Your variable list could be
{fbas}{tab}{path}{tab}{caption}   Save as a single file and don't forget to add the .txt file extension. The text file can be opened in Excel, then sorted by column c, the Caption field contents.  You could then copy the matching filenames from column a into a separate text document. Call it Caption-1-selects.txt. Now this file can be loaded into Photo Mechanic using the Load Selection option from the Edit menu.
  Now you should be able to do a Find and Replace on the selected group, so you don't accidentally update the wrong set of files.   Repeat the process for the next Caption block in the Excel spread sheet. I hope this helps.
 
--Bob

Offline foyle3

  • Member
  • **
  • Posts: 53
    • View Profile
Re: Bulk caption edit
« Reply #7 on: October 30, 2017, 08:27:34 AM »
Couldn't get that to work and tried several variations.  Am I right that the aim is to have a string of words (redundant captions) separated by tab spaces in the "Find" box ?  Or is there somewhere to change that to camma or... whatever ?  I'm ploughing on term by term between other work on the grounds that it works and might take a lot longer to learn a faster way.  What happens when a revised folder is re-entered in iMatch database is soul destroying - "64 hours to go" says the info but that's just to make me feel better when it only takes  seven and a half.  Thanks for suggestions.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Bulk caption edit
« Reply #8 on: October 30, 2017, 08:58:08 AM »
Couldn't get that to work and tried several variations.  Am I right that the aim is to have a string of words (redundant captions) separated by tab spaces in the "Find" box ?  Or is there somewhere to change that to camma or... whatever ?  I'm ploughing on term by term between other work on the grounds that it works and might take a lot longer to learn a faster way.  What happens when a revised folder is re-entered in iMatch database is soul destroying - "64 hours to go" says the info but that's just to make me feel better when it only takes  seven and a half.  Thanks for suggestions.

I'd suggest doing a text export like Bob suggested, but then use that text file as a Code Replacement file.  You would edit the Captions in a text editor (UTF-8 compatible would be best) which should make it easier to trim off the parts you want gone.  Then save the file and use it as a Code Replacement file.  Then use the IPTC Stationery Pad to bulk apply your corrections to all of your images at once.

If you export like so:

{filename}[tab]{caption}

Then edit the text file and fix up your captions (don't add any other tabs during the editing) and save the file.
Then back in PM, open up the Code Replacement dialog (Edit->Settings->Set Code Replacements...) and Add... your file to the list.  Then OK the dialog.
Next, select your images and then open up the IPTC Stationery Pad (Image->IPTC Stationery Pad...) and uncheck all fields.  Then find the Caption field and enter your Code Replacement delimiter (default is backslash) and the {filename} variable followed by another Code Replacement delimiter like so:

\{filename}\

This will use the filename of the file currently being processed as the Code to look up the Replacement.
Change the popup menu to the left of the Caption field (under the checkbox) to "Replace".
Apply the IPTC Stationery Pad.  It should run through all of your selected images, and correct all of their captions.

Make sure that you don't have any images selected that aren't represented in your text file or their captions will be cleared.

HTH,

-Kirk

Offline foyle3

  • Member
  • **
  • Posts: 53
    • View Profile
Re: Bulk caption edit
« Reply #9 on: October 30, 2017, 09:35:52 AM »
Love it when someone thinks outside the proverbial box.  Neat idea. May be issues with variable rogue terms ie not identical in all images.  Some messages say "replaced 251 occurrences in 251 images"  while others say " replaced 2786 in 1581 images" - but it's got my brain engaged.  Wish my brain had been engaged when I made the very diligent and painstaking mistake originally :-\