Author Topic: Merge IPTCMETA DATA from Spreadsheet into images  (Read 33314 times)

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24965
    • View Profile
    • Camera Bits, Inc.
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #15 on: October 20, 2011, 10:31:17 AM »
This is an incredible way to learn ... and fun ... and it works. Your instructions are clear and understood. Thank you Kirk.

Here are two areas that may require some thought:

1) Commas in Caption

Because my original spreadsheet entries did not contain COMMAS I added them later. During this process COMMAS were added to all fields including the caption. (My fault and part of the replace SPACE with COMMA theme).

The caption looks like this: Child,playing,with,toy

You could use the Find and Replace panel to search the Caption field for commas and replace them with a space character.


Quote from: Old timer
2) I threw in a few images without a corresponding spreadsheet entry (including 200902_0005.jpg). It now contains this:

=200902_0005.jpg#2= =200902_0005.jpg#3= =200902_0005.jpg#4=

Could be a problem for some photographers as it seems to wipe out the original data (as requested) and replace it with Gibberish. Is there a way to instruct the software to IGNORE IMAGES THAT DO NOT HAVE A SPREADSHEET IMAGE NUMBER?

No, there is no way to do that.  Those images will just have to be cleaned up.  You could always export a list of filenames with the Text Exporter (File->Export) and double-check first.

Quote from: Old timer
... With 2GB of Ram ... maximum images per folder?

There is no hard limit.  Just certain things will get slow with a large number of items in a folder.  You should be able to have a few thousand images in a folder if you like, though I wouldn't recommend putting that many images in a folder unless they were all from a single job/shoot.  Organization is key when you have a lot of images.

-Kirk

Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #16 on: October 21, 2011, 07:06:51 AM »
Kirk ... THANK YOU!

Offline riecks

  • Beta Testers
  • Newcomer
  • *
  • Posts: 29
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #17 on: July 15, 2012, 09:38:10 AM »
Old Timer:

For others that wander across this in a search, the following tutorial on "Using Photo Mechanic’s Code Replacement to Insert Keywords from a Text File" might help.

http://www.controlledvocabulary.com/imagedatabases/cv-photo-mechanic-code-replacement.html

David


Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #18 on: November 14, 2012, 05:42:10 AM »
Kirk,

Something has changed, and I'm not sure what ... but I'm sure you have the answer.


CAPTION FIELD: \{filename}#1\

KEYWORD FIELD: \{filename}#2\ \{filename}#3\ \{filename}#4\

This is part of my old text (that previously worked):

Filename   Caption128   key,50   key,300   key,856         ,
200902_0001.jpg   House   Architecture,building,buildings,   residence,home,homes,   tin,shack,metal,rust,poverty   ,     
200902_0002.jpg   Child,playing,with,toy   Child,children,toy,toys,   play,fun,games,happy   plastic,car,   ,     
200902_0003.jpg   Zulu,warrior,   Man,adult,Zulu,warriors   weapon,weapons,   spear,knife,native,   ,

This is a new version:

testPic1-4.jpg   arrest,arrested,under,imprisoned,celebrity,famous,people,person,human,humans,adult,adults,male,man,men,USA,actor,actors,front,SINGLE,ADULT,HUMAN,PORTRAIT,booking,photos,for,crimes,alleged,law,enforcement,duress,detained,fair,use,Commons,Mugshot,1,Shot,L,P, 

RESULT FAIL:
\testPic1-4.jpg#1\

\Celeb_MugShots_viaWEB_cobainmug1-4.jpg#2\ \testPic1-4.jpg#3\ \testPic1-4.jpg#4\

Thank you










Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #19 on: November 14, 2012, 05:52:34 AM »
I'm not sure what you mean with the bit after "RESULT FAIL:", but one big difference between your old and the new entry is the fact that you have only one field defined for your test file, not the four you previously had defined. This would mean the whole bit from arrested to P, would end up in the caption field and nothing in the keyword field.

Also make sure the whitespace between the filename and the fields is a tab character, not a (number of) spaces.

Hope this helps,
Hayo
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #20 on: November 14, 2012, 06:13:31 AM »
Thanks for your reply and help Hayo ...

I did try about 20 different versions this morning (including the original text file that prviously worked), and the result of each test was the same. The file name was repeated once (into the caption field), and three more times into the keywords area.

This piece of text worked last year, but not today:

200902_0001.jpg    House    Architecture,building,buildings    residence,home,homes    tin,shack,metal,rust,poverty
200902_0002.jpg    Child playing with toy    Child,children,toy,toys    play,fun,games,happy    plastic,car
200902_0003.jpg    Zulu warrior    Man,adult,Zulu,warriors    weapon,weapons    spear,knife,native

I know it's a mess, but I'm re-posting it becasue it did work (even though it's full of junk).

The result from this is the same .. file name repeated four times.

Thanks again




Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24965
    • View Profile
    • Camera Bits, Inc.
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #21 on: November 14, 2012, 07:03:10 AM »
Thanks for your reply and help Hayo ...

I did try about 20 different versions this morning (including the original text file that prviously worked), and the result of each test was the same. The file name was repeated once (into the caption field), and three more times into the keywords area.

This piece of text worked last year, but not today:

200902_0001.jpg    House    Architecture,building,buildings    residence,home,homes    tin,shack,metal,rust,poverty
200902_0002.jpg    Child playing with toy    Child,children,toy,toys    play,fun,games,happy    plastic,car
200902_0003.jpg    Zulu warrior    Man,adult,Zulu,warriors    weapon,weapons    spear,knife,native

I know it's a mess, but I'm re-posting it becasue it did work (even though it's full of junk).

The result from this is the same .. file name repeated four times.

Thanks again

Do you have only this one code replacement file loaded, or do you have several code replacement files loaded?  Can you post your actual file, and not paste it in, please?  Use the 'Attachments and other options' link when you're composing your reply to this message and there you'll be able to upload your code replacement text file.

Thanks,

-Kirk

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #22 on: November 14, 2012, 12:39:17 PM »
Have you by any chance changed your code replacement delimiter character from a backslash to something else?
(Edit|Settings|Code Replacement, “Delimeter character” bottom left of the dialogue). That would fully explain you results.

If this is the case, either change it back or change the caption/keyword text to use the new character instead of the \
For instance, with the delimiter set to ` (backquote) you'd have to change your entry to read as follows:
KEYWORD FIELD: `{filename}#2` `{filename}#3` `{filename}#4`

Hope this helps,
Hayo
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #23 on: November 16, 2012, 02:12:08 AM »
Kirk and Hayo,

Thank you! The problem is solved, and I wish I could explain what it was. This is how I got things working, in case it is of interest.

I started with a 32mb spreadsheet in the wrong format for my version of excel to open .. an .xlsx file.

Downloaded 'open office' but it was unable to open the file.

Uploaded the xlsx to an internet site offering file conversions .. which sent me an .xls which I was able to open in Excel.

Removed lots of junk and reduced the file size to 12mb. Added commas between words ...which partly worked, took hours to ass 22 million commas.

Tested some changes on a smaller version. This was a good idea becasue I somehow had a comma added to the file name which rendered it useless. Fixed that.

Opened and closed the file a few times using different software, each of them producing a slightly different result.

Removed some of the extra junk added, tried, worked on some files, but not all.

My guess is, the spreadsheet is either incorrect, or has some otehr errors.

Anyway, the main batch of 4000 images did work, anad they are now keyworded via the spreadsheet info.

Today's problem concerns Lightroom v2.6 which strips out, or removes most of the keywords upon export .. on some file only. Still puzzled.

Bye for now.


Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #24 on: November 22, 2012, 02:46:29 AM »
Another problem:

I would like take text from OBJECT NAME and add it to the keywords. In front of other words would be best.

Is this possible?

Thanks again

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24965
    • View Profile
    • Camera Bits, Inc.
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #25 on: November 22, 2012, 11:50:47 AM »
I would like take text from OBJECT NAME and add it to the keywords. In front of other words would be best.

Is this possible?

Sure, mostly.  Use the IPTC Stationery Pad and enter:

{object}

into the Keywords field.  Make sure the '+' (append) checkbox is set.  Your object name values will be appended to the current keywords.  There is no prefix mode for keywords since they're an unordered list anyway.  Some applications sort them, some don't.

-Kirk

Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #26 on: November 22, 2012, 01:04:58 PM »
Kirk. Thank you!

Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #27 on: November 22, 2012, 01:21:35 PM »
Kirk,

My question lacked important detail. Working on thousands of images, many of them coutaining rubbish .. ©= ... has given me a mish mash to work with.

It would be better to take the OBJECT NAME from the image itself, rather than from an outside .txt file (which doesnt exist).

Example to clarify. The image contains this text:

Keywords: happy sitting
Object name: fat man chair

Text from both areas needs to live in the keywords area. All data contained within image itself.

Possible?

When I used {object} on the stationary pad, nothing happened.


Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #28 on: November 22, 2012, 01:37:28 PM »
Kirk, you are right, and I made a mistake.

{object} Does work. The reason I thought it didn't: Test photo contained same text in object name and keywords .. so it was doing thigs as it should, but on that particular image, nothing noticable.

Will probably waste some more of your time soon.


Offline Old timer

  • Member
  • **
  • Posts: 55
    • View Profile
Re: Merge IPTCMETA DATA from Spreadsheet into images
« Reply #29 on: November 23, 2012, 12:49:12 AM »
Kirk,

Keywords on 30,000 improved overnight by adding 'object name' to keywords ... using {object} 

Great. Keywords now reasonable.

Another question:
Is it possible correct a spelling error within the keywords of some images ... all pix at once?

Example:
nativ = native
poo = poor