Write metadata "instructions"

Hi
I´m trying to edit the metadata "instructions" in some photos vieweb by Bridge. At true, I need to preserve what´s already written in this field, then add some more things via script.
Here´s my try:
var doc = app.document;
doc.selectAll();
var sel = doc.getSelection ("psd, ai, tif, tiff, jpg, png, bmp, jpeg");
if (ExternalObject.AdobeXMPScript==undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
for (var g=0 ; g<sel.length ; g++){
     var xFile = new XMPFile (sel[g].spec.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
     var xmp = xFile.getXMP();
     var x = sel[g].metadata;
     var instruc = new String (x.read ("http://ns.adobe.com/photoshop/1.0/", "Instructions"));
     instruc = instruc + "<test bonus instruction>";
     //up to this line, everything is right
     xmp.deleteProperty (XMPConst.NS_XML, "instructions") //problem is this line and/or the line below. It does not return error, but do not write too.
     xmp.appendArrayItem(XMPConst.NS_XML, "instructions", instruc, 0, XMPConst.ARRAY_IS_ORDERED); //problem can be here.
if (xFile.canPutXMP(xmp)){
     xFile.putXMP(xmp);
     xFile.closeFile(XMPConst.CLOSE_UPDATE_SAFETY);
What Am I missing?
Thank you a lot for the help
Best Regards
Gustavo.

Gustavo… XMP is not one of my great strengths so I may well be wrong… Anyhows I don't this the instructions property is an Array but a simple String…
#target bridge
if ( loadXMPLibrary() ) { processThumbnails() };
if ( unloadXMPLibrary() ) { alert( 'were done' ) };
     Process the thumbnails in Bridge
function processThumbnails() {
     var i, count, doc, smd, inst;
     doc = app.document;
     count  = doc.visibleThumbnailsLength;
     for ( i = 0; i < count; i++ ) {
          if ( /\.(ai|bmp|jpg|jpeg|png|psd|tif+)$/.test( doc.visibleThumbnails[i].name ) ) {
               if ( doc.visibleThumbnails[i].hasMetadata ) {
                    smd = doc.visibleThumbnails[i].synchronousMetadata;
                    inst = smd.read( 'http://ns.adobe.com/photoshop/1.0/', 'Instructions' );
                    undateXMP( doc.visibleThumbnails[i], inst );
     Update the XMP properties…
function undateXMP( thumb, inst ) {
     var xmpFile, xmp;
     xmpFile = new XMPFile( thumb.spec.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE );
     xmp = xmpFile.getXMP();
     inst += ', elmo';
     // The line below returns an XMP error the property is NOT an Array…
     //xmp.appendArrayItem( 'http://ns.adobe.com/photoshop/1.0/', 'Instructions', XMPConst.PROP_IS_ARRAY, inst, XMPConst.ARRAY_IS_ORDERED );
     xmp.setProperty( 'http://ns.adobe.com/photoshop/1.0/', 'Instructions', inst, 0, XMPConst.STRING );
     if ( xmpFile.canPutXMP( xmp ) ) {
          xmpFile.putXMP( xmp );
          xmpFile.closeFile( XMPConst.CLOSE_UPDATE_SAFETY  );
     Load the XMP External Object Library
function loadXMPLibrary() {
     if ( !ExternalObject.AdobeXMPScript ) {
          try {
               ExternalObject.AdobeXMPScript = new ExternalObject( 'lib:AdobeXMPScript' );
               return true;
          } catch(e) { return false; };
     Unload the XMP External Object Library
function unloadXMPLibrary() {
     if ( ExternalObject.AdobeXMPScript ) {
          try {
               ExternalObject.AdobeXMPScript.unload();
               ExternalObject.AdobeXMPScript = undefined;
               return true;
          } catch(e) { return false; };

Similar Messages

  • Can no longer write metadata to Raw files

    My team an d I are working in Photoshop CS5, we write metadata to jpegs and Raw files- saving to Raw database not as sidecar .xmp files.  We are no longer able to save the metadata to Raw files.  There is no error message, the data writes like normal and the user who writes the metadata can see it but when you open in another computer the metadata fields are empty, however the jpegs do have the new metadata.  Was there a setting change at some point? This has been going on for a couple months and I cannot find an answer anywhere.  Again, we batch write to RAW+Jpeg, the jpeg files save the metadata but the Raw files look like the data saved but is not visible on any computer other thant he one that added the new metadata. This is occurring on multiple computers, both Mac and PC.

    TimVasilovic wrote:
    I understand the process you are describing,  In the past I have been able to embed metadata to a Raw file, move it to a server, pick that file up on another computer and see the metadata without need of the .xmp sidecar.  Is the ability to embed no longer supported  by Photoshop? Since this issue began we have taken to doing all our metadata editing in PhotoMechanic, which embeds without creating a sidecar.  If Photoshop is pushing people to create sidecar .xmp files only for writing metadata to Raw files I will probabaly move fully to PhotoMechanic because using sidecars has proven tricky in the past with how our files get moved around.
    If using Adobe Camera Raw on camera raw file you either have an XMP sidecar file created or the data is stored in a database.  Which happens it is your option in Edit/camera raw.  If you use ACR and edit a jpeg it does not create a distinct XMP file but it is also not directly written to the image either.  One can still delete the edits in Bridge with Edit/develp settings.
    If you use a DNG the metadata is written to the image.  Not sure what process Photo Mechanic uses.
    It appears to be a permission problem as other than CS6 Bridge is now 64 bit and has a new cache method there are no changes in how it handles metadata.

  • 5 stars not showing up on other computers when importing images that have been worked on. Catalogues settings include write metadata to xmp keywords do show up though

    our working group usually one team member imports and completes job in lightroom 5 . All settings on team computers include write metadata to xmp.  Key words show up if another team member adds the images to their catalogue but the 5 stars don't show up.
    We use the 5 stars to show images that were worked on and complete.
    Would love to sort this issue out as we rely on being able to see the star rating not just keywords.

    [Sorry for the delay in getting back.] Of the three files you included in the Dropbox .zip, 2 had no rating, and 1 had a 5-star rating (*research*.dng).  So indeed, the rating didn't get written to those two files and wouldn't show up when they were imported into another catalog.
    A couple of suggestions:
    1. Triple-check that the option Automatically Write Changes Into XMP is set in Catalog Settings > File Handling in everyone's Lightroom.
    2.  After someone sets the rating, check the thumbnail in Library grid mode -- does it have a badge in the upper-right corner indicating the metadata needs to be updated?  If it does, then that means the metadata isn't getting written immediately back to the file:

  • Lightroom 5 can't write metadata to DNG files

    I have converted a large number of Canon and Nikon raw files to DNG using Adobe DNG Converter (version 8.2.0.94). 
    Using Lightroom 5.2 I wanted to change metadata in these master DNG files.  I import the files into a catalog, select all, modify the metadata, then invoke the Metadata->Save Metadata to Files...  For many (but not all) of the files I get the following message:
    "Could not write metadata.  Unknown file formats."
    The DNG files reside on a Synology NAS server.  If I copy them to a local disk I do not get the above error.  But I would like to make metadata changes to the files on the NAS.
    I do not have problems importing or viewing DNG files from the NAS.  Why does LR 5 have problems writing DNG metadata to the NAS?  How can I fix this?

    Thanks for replying.
    The problem is definitely not one of permissions. I am accessing the NAS from an admin account with full permissions to read/write the files and directories.
    I'm inclined to believe it's the second cause you propose -- network protocol causing data corruption. 
    It seems to be specific to writing metadata to large files such as DNG or TIFF.  I don't get errors writing to JPEG.  And it is inconsistent -- sometimes retrying fixes it.  And, oddly, sometimes I even get the error "photos have read-only access" when it's clear the permissions are OK.
    On the other hand I have had no problems copying thousands of DNGs to/from the NAS -- no errors and no corruption.  So the issue seems to be an interaction between the NAS and LR when LR is updating the metadata on an existing file and the file is large.

  • SharePoint writer metadata information in a SharePoint farm with multiple WFE servers.

    I  am working on Microsoft Volume Shadow Copy Service (VSS) framework. I know that in a 3-Tier SharePoint environment the SharePoint writer metadata on WFE server gives all the information related to that farm.
    My question is -
    a) How would i get all the information related to the SharePoint farm from the SharePoint writer metadata in an environment where multiple WFE servers are configured?
    b) Is it possible that in a SharePoint farm where multiple WFE servers are deployed, SP writer of only one WFE server (Master/Main server) contains all the information about the respective SP farm servers in its metadata?

    Hi  Aaditya,
    All Writer Metadata is stored in Writer Metadata Document which is produced by writer. The backup application uses the  Writer Metadata document to get information about that writer, the data it owns,
    and how to restore that data. Once the writer produces it, the Writer Metadata Document is a read-only document to the backup application.
    The Writer Metadata Document contains three sets of data: writer identification and classification information, writer-level specifications, and component data.
    For getting Writer Metadata, you can use
    IVssBackupComponents::GetWriterMetadata method.
    For more  information, you can refer to the articles:
    http://msdn.microsoft.com/en-us/library/aa384992(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/library/aa384996(v=vs.85).aspx
    http://blogs.technet.com/b/dpm/archive/2011/06/02/explaining-sharepoint-data-source-enumeration-with-data-protection-manager-2010.aspx
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Bridge won't write metadata; Photoshop will

    I have some TIFFs created from scans. Here's the problem I'm seeing.
    When opening the image in PS CS5 I often get a message saying This file contains file info data which cannot be read and which has been ignored.
    First, I try to change some metadata in Bridge and save the image. Sometimes this solves the problem. Often, though, I get a message saying There was an error writing metadata to "filename".
    Next, I open the image in PS simply clicking OK on the error message above. I open File Info, change some metadata and save the image. So far this has always solved the problem thus far.
    The source of hte problem will likely not be easy to discover since the error message provides no useful information and since it is happening frequently, but not universally. At first I thought it was related to specific fields, but further testing seems to indicate it is not. Then I thought since another running application gave me a low storage message, it might be related to that. That does not seem to be the case either.
    However, even if I don't find the root cause, it would be helpful if Bridge would simply rewrite the metadata to fix the problem rather than having to go into PS.
    Any thoughts?
    Dale

    From
    what you are saying the TIFF's are corrupt somehow.  Open them in PS
    and then save with another name and see it you can then write metadata.
    For whatever reason Bridge may be more sensitive to the error than PS. 
    Can you change the scan to another format to eliminate the problem?
    Granted the metadata is somehow corrupt. However opening them in PS and then saving them with the same name solves the problem, so it must rebuild the corrupt metadata fields.
    I've scanned several hundred TIFFs and only had the problems on a few files. The only archival formats Nikon Scan 4 gives me are TIFF and nef and if I used nef ACR won't recognize the colorspace.
    Dale

  • Does FCPX write metadata back onto media files?

    Does FCPX write metadata back onto media files? Compaired to Premiere or Prelude which does.
    If so, are keywords and roles considered metadata that is written into the media?
    Thank you in advance,
    DKG

    I beg to differ.
    I have *my* media, that is stored in *my* hard drive, and may linked at by different projects and events, I don't want any software to go behind my back and change it. Metadata is just about as important as data, and clips are different, and *separate* from media files. It's fine that FCP X attaches and makes great use of metadata for clips, it's wrong if it messes with metadata in the media files.

  • Nikon D60 - Bridge CS3 cannot write Metadata

    {This is a follow on to thread: http://www.adobeforums.com/webx/.59b6704d/1}<br /><br />It appears that Bridge CS3 is unable to write some of the IPTC metadata to pictures taken with my Nikon D60.  When trying to change some metadata in a file I get the message "There was an error writing metadata to <filename>"<br /><br />Strangely this does not happen with all metadata fields. For instance, I can change the IPTC Core "City" or "Location" and the change works just fine. However, if I try changing IPTC Core "Creator" or "Copyright Notice" I get that error.<br /><br />I have confirmed that the problem is with the D60 pictures, as it occurs in two different machines (Both CS3, one Vista, one XP).  Both machines are able to edit other camera's pictures OK.  All files are in JPEG format, I have not tried anything in RAW format.<br /><br />I did find in a completely different forum (for BreezeBrowser, which I've never used) a reference to a similar problem.  At least in that forum they mention that the Nikon D60 uses a "different" way of storing metadata which leads to the problem.  BreezeBrowser will release a new version to address this issue.  <br /><br />Any idea what the solution might be for Bridge and other Adobe products?<br /><br />Thanks!<br />Carlos

    I don't have my camera with me at the moment, so I'll have to shoot in NEF later. However, just for kicks I downloaded the latest version of ACR and checked against my current version. It appears to be the same (same size, same timestamp). I even replaced it, per the instructions with the download. No love.
    As mentioned in my original post, the issue is limited to a few fields, in particular "Creator" (XMP) or "By-line" (IPTC). I went and added new data to this field using ExifTool. I added it to both IPTC and XMP fields since I know Bridge synchronizes them. The change took, and Bridge noticed it. But now Bridge will not let me modify any XMP/IPTC metadata. It won't even let me change the rating of the file!
    I'm really at a loss here. I've searched through other threads and haven't found anything to enlighten me.

  • Any  API's to write metadata to database?

    I have this unique situation wherein I need to extract the DDL objects (procedures, packages, functions) from database. I was able to solve this by using the DBMS_METADATA.GetDDL() API.
    Now, I have another situation wherein I need to write the changes to DDL objects to database. I dont want to use TOAD to compile. The objective is to use an API to write any changes to DDL objects.
    I could not find any API's that would do the work similar to GetDDL to write back, but could not find any.
    Any help is appreciated.
    Thanks
    Ash

    Let me explain the situation. In our current setup we use TOAD to create/change our custom objects (Package, Procedure and Function). When a change is ready to be migrated to production we copy the source code from development and paste it into production Toad editor and execute the object to save in database.
    We want to get away from that and deploy the changes using command line (this idea is to use subversion to capture chanes and deploy through a script).
    Now to implement this solution, broke it down to two components
    1) Extract all custom objects' metadata and store in folders. For this I used DBMS_METADATA.getDDL() API and passed the parameter like 'PACKAGE', 'PROCEDURE' etc. I wrote a java program and ran that program from windows command line and I'm able to see all the objects retrived, saved into corresponding file names and into their respective folders.
    2)Deploy. As as developer, I would get the source code for an object from one of the folders in my windows environment and then make the necessary modifications. Lets say for eg. test1.prc is a procedure that I extracted from database and I modified the code. Now I'm ready to deploy this code change in production.
    Two ways of deploying in production 1) Use Toad to execute the changes and 2) Use SQLPlus to compile the changes.
    I'm looking at a 3rd alternative wherein if there is any API's similar to GetDDL() (I wish they had SetDDL), I would write a JAVA wrapper to send the changes back to database.
    If we do not have one, the only way I can think of is to call sqlplus through program and then compile the object. (This would be my alternative solution).
    Hope I explained it clearly.
    Thanks
    Ash

  • Lightroom won't write Metadata.

    After importing RAW and JPEG files I can use Tools to replace Metadata for all RAW files but I cannot change Metadata for any of the JPEG files. Not by Tools or individually.
    Duel 3 Ghz. Quad Core Mac Pro, 8 G RAM, 2.25 TB RAID, additional external HD's.

    Yes, it's maddening.
    I don't get an error message. I'll have to try to write the metadata to file to seet what happens. But, you would think that the way LR works, you should not have to write the data when you make a web site, or when you export. Are we the only one's complaining? A work-around would be to export and then write the metadata with Bridge -- defeats the whole purpose of LR.
    Despite a year of beta testing, LR sees like it's full of bugs, and a heap of features that seem illogical, at least for me. That's the problem of software by committee, or forcing us to use someone elses work flow model. I think a lot of hot shot photographers may not understand the digital work flow enough to consult on software development. I got a discount through NAPP, but I feel like I paid too much.
    I'm going to try Aperture.

  • How to write IPTC metadata to files without opening the file?

    HI,
    I'm trying to run a script (preferably in JS) that allows me to write metadata to a file. I can acheive this very easily by opening the file, but I'd need to batch process many large images, so opening them would cause severe slowness. The purpose of adding the metadata to the files is to search upon them in Bridge.
    We're using CS5, but have CS6 if it's better to use.
    My Script
    // set current doc ref
    var docRef = app.activeDocument;
    // Set caption in active document
    docRef.info.caption = "Some Meta-Data";
    Do I need to use bridge to write the metadata without opening the file? Or can running the script in PS allow me to do so?
    Thanks,
    Tom

    Its easy if you use XMP metadata.
    app.activeDocument.info.caption (in photoshop script metadata)
    and it is the same field as:
         Dublin Core namespace
         namespace:     http://purl.org/dc/elements/1.1/
         Property:          description
    you change description on XMP = you are changing the same image.info.caption
    Your answer is here:
    http://forums.adobe.com/message/5743730#5743730

  • "Automatically Write Changes Into XMP" Not Working for DNG Files

    Hello,
    I am needing to update DNG/JPG file pairs with keywords that I add  in lightroom.  The following is the problem that I am encountering. 
    When the image consists of only a JPEG file (ie. I had my DSLR only snap a jpeg and not an associated DNG), and I add one or more keywords to the file in Lightroom, these are written / saved immediately in Lightroom and are visible immediately in the 'tags' column for that image in windows explorer.  Very useful and important functionality for my workflow.
    However, when the image consists of both a JPEG and a sister DNG (i.e.,snapped simultaneously by my DSLR), and I try to add keywords to these (treated at this point as a single image by lightroom) then Lightroom does not record the keywords into either of the two files and consequently no tags are visible in windows explorer.  I have confirmed this apparent problem with a seperate image metadata utility software, and am hoping that it's just something simple that I am missing.
    Also "Automatically Write Changes Into XMP" is selected and I have also  tried manually both: "right click," "metadata," "write metadata to file;"  and  "right click" "update DNG preview and metadata" and the problem  persists.
    Hopefully someone has encountered something similar and can point me in the right direction.
    Thanks in advance.

    @Eric: hitting cntrl+s works but can be tedeous on large galleries. I've been doing this but it can be a pain.
    @Jeannine: different topic than this thread but to answer anyways... Lightroom automatically saves all changes into your catalogue. You never need to dave your changes (here's the kicker though) as long as you do not move the original file. If you
    move the file than lightroom won't know that it's the same image as the one you've edited. Once you are done editing your image you will need to "export" the image to a new file (you don't wan to overwrite the original). If you don't export than only lightroom will have your edits. Lightroom is "non-destructive" Which means that it doesn't touch your original photo. Lightroom keeps a text file containing the instructions on what you did to make the edited version. Since your changes are just text inatryxtions you have to "export" the image to get your final image in a version you can put online, print, etc. But to answer your original question, I think you prob moves the original image. If not, could you give us more info?

  • Read metadata from file cancel modifications !

    Hi,
    I use Lightroom 1.1 in french. I made some photo (in raw but in jpeg the result is the same) and import them in Lightroom with conversion in DNG. In Lightroom, in develop module, I crop, change contrast and som others.
    After that, I geotag my DNG files with HoudahGeo. HoudahGeo write geotag in the file. So back in Lightroom, I make a 'Read metadata from file' ('Lire les métadonnées depuis les fichiers' in french) for having geotag in Lightroom.
    Geotag are now in Lightoom, nice, but in develop history, I have a new line 'Rénitialiser les paramètres' !!! So I can't see all my modifications... Is it normal ?
    Thank you
    PS: Sorry for my english...

    I think you should test this with one or two pictures - import/convert, save metadata to file, geotag, read metadata. Also try import/convert, make small adjustment, save metadata to file, geotag, read metadata. In iView I often write metadata to DNG's that have been adjusted, then read the metadata in Lightroom - sometimes I add more data in iView and do more adjustments.
    I have seen the problem you describe, but it has been with raw files which I have adjusted in Lightroom but haven't saved out the metadata. I have then created an xmp sidecar in iView, and read the metadata in LR. So the sidecar had no ACR/LR instructions. The result was that my adjustments were wiped out. What I suspect is that something similar is happening with your DNGs - that conversion creates them but doesn't write the ACR/LR fields.
    So try a few alternative sequences.
    John

  • Read Metadata from TIFF-file

    Hi All!
    I try to get metadata from a TIFF-file. I tried to do this with this code. Everytime i get the same error. Anyone can help me?
    int imageIndex = 0;
    File f = new File(sourceFile);
    ImageInputStream stream = ImageIO.createImageInputStream(f);
    Iterator iter = ImageIO.getImageReaders(stream);
    ImageReader reader = (ImageReader)iter.next();
    reader.setInput(stream);
    IIOMetadata m = reader.getImageMetadata(imageIndex);
    Errormessage:
    run-single:
    Exception in thread "main" javax.imageio.IIOException: I/O error reading image metadata!
    at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.readMetadata(Unknown Source)
    at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.seekToImage(Unknown Source)
    at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.getImageMetadata(Unknown Source)
    at tiffmetadatabug.Main.main(Main.java:80)
    Caused by: java.io.EOFException
    at javax.imageio.stream.ImageInputStreamImpl.readShort(ImageInputStreamImpl.java:211)
    at javax.imageio.stream.ImageInputStreamImpl.readUnsignedShort(ImageInputStreamImpl.java:222)
    at com.sun.media.imageioimpl.plugins.tiff.TIFFIFD.initialize(Unknown Source)
    at com.sun.media.imageioimpl.plugins.tiff.TIFFIFD.initialize(Unknown Source)
    at com.sun.media.imageioimpl.plugins.tiff.TIFFImageMetadata.initializeFromStream(Unknown Source)
    ... 4 more
    Java Result: 1

    I think you should test this with one or two pictures - import/convert, save metadata to file, geotag, read metadata. Also try import/convert, make small adjustment, save metadata to file, geotag, read metadata. In iView I often write metadata to DNG's that have been adjusted, then read the metadata in Lightroom - sometimes I add more data in iView and do more adjustments.
    I have seen the problem you describe, but it has been with raw files which I have adjusted in Lightroom but haven't saved out the metadata. I have then created an xmp sidecar in iView, and read the metadata in LR. So the sidecar had no ACR/LR instructions. The result was that my adjustments were wiped out. What I suspect is that something similar is happening with your DNGs - that conversion creates them but doesn't write the ACR/LR fields.
    So try a few alternative sequences.
    John

  • Need advice on recovering metadata

    Let me explain that subject line:
    I made a completely brain-dead move and accidentally deleted some RAW files (83 to be exact) after
    they were imported. LR says they're missing and I have not yet deleted them from the LR catalog. I
    used the lightroom_recover app to extract the JPEG previews to JPG files and I've realigned
    filenames so where I used to have FOO1.CR2, I now have FOO1.JPG and so on.
    What I'm looking for advice on: LR doesn't store much metadata in the JPEG preview files so now what
    I'd like to do is somehow get the metadata in LR's database into the recovered JPEGs. Once I do
    that, I'll delete those CR2's from the LR database and import the JPEGs.
    I don't want to distract from the above topic but FWIW, what I did was import from my camera's
    memory card but somehow, instead of copying files to the hard disk in my laptop as usual, I imported
    in-place without knowing. Once the card was back in the camera and reformatted, kiss those files
    goodbye. Which all made me wonder: has the notion of "import presets" been discussed and what was
    the general consensus if so? Knowing that with one button I could set all options in the import
    dialog to a known-good set of options might have prevented this.

    I've resolved this as best I can and I'll outline the steps here in case someone else has this
    problem later and searches the forum for a solution. This is a long post.
    As Tim says, if all you want to recover is your IPTC metadata, then it's trivial: import the JPEGs
    you recovered with lightroom_recover, have LR sync the metadata, then remove the original files from
    your catalog.
    I wanted to recover the EXIF metadata as well though and that required several more steps (I wish LR
    were more capable in terms of EXIF handling). Here are the steps I took. I'm interested to hear if
    others find an easier way. You need to be comfortable with the command-line for this. The general
    idea is to put dummy RAWs back where the lost files should be so that LR believes they are now
    there. Then have LR write metadata to disk for those. Then put that metadata into the recovered
    JPEGs.
    1) Do NOT remove the missing files from LR yet. If you've done that, the metadata you are trying to
    recover is gone.
    2) Extract the jpegs from LR's previews using lightroom_recover.exe (available here:
    http://www.ploki.info/index.php/Main/LightRoomRecover). The JPEG files will be named after the
    internal LR ID for the photo. For clarity, you will want to spend the time renaming them to match
    the originals. For instance, for every foo.CR2, I found the matching JPEG file and named it foo.JPG.
    Place the JPEG files in the same directory where the lost files were. Yes, this is tedious.
    3) Copy any old RAW file you have around into the directory where the lost files used to be. There
    should be one copy per lost file. E.g.: copy the same dummy.cr2 to foo1.cr2 and foo2.cr2 and so on.
    You can probably do this several ways including manually. I used a simple for loop from bash:
    for x in *.JPG; do cp ../dummy.CR2 `basename $x .JPG`.CR2; done
    4) Back to LR, try to view the lost images in the Library module. It should now "see" them although
    it will give you a preview to match the dummy file instead of the original. This is ok at this point
    because you saved your images in step 2. Select all of them and write their metadata to disk with
    Ctrl+s.
    5) You should now see a bunch of updated .xmp files for each of the lost RAW files. Use exiftool
    (available here: http://www.sno.phy.queensu.ca/~phil/exiftool/) to copy the metadata in those to the
    recovered JPEG files with this command:
    exiftool -TagsFromFile %d%f.xmp -all:all -ext jpg .
    6) Almost there. Exiftool keeps the original JPEG files with _original appended to the file name.
    You need to move these to another folder to avoid LR thinking these are sidecar JPEGs when you
    import. Don't delete them since they're your precious images - move them instead.
    7) In LR, import the recovered JPEG files. Verify that the EXIF metadata looks good in Library. If
    so, you can go ahead and remove the originals from the catalog and you're done.
    The above steps assume original RAWs with XMP sidecars. For DNG users, I haven't tested a solution
    but I would change step 3 to copy a dummy DNG file instead and change the exiftool command in step 5
    to extract metadata from DNGs instead of XMPs.
    - Dave

Maybe you are looking for