• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

metadata changes problem

Engaged ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

I started using Topaz denoise and a strange problem arises.  In the description field, I have a scientific name followed with 2 spaces by common name.  ie. Canis domesticus  DOMESTIC DOG.   At some point in the past I had the reverse,  DOMESTIC DOG  Canis domesticus.  The order is important, because I use captions which take this in galleries and sort species alphabetically.  

So when I go through a folder of tiff in Topaz, making individual changes, I find that many, sometimes almost half change from the present order to a previous order, and also I noticed one had the keywords change.  In a family folder, there may be slide scans, or digital shots but the type or date doesn't seem to matter.  I saw some from 1997 or 2002 that didn't change. In another case, I saw that the location was missing in the metadata and added that and sublocation.  When the operations were completed, I saw that the location and sublocation data were there but the naming order reversed to the earlier time.  Does it have something to do with the way xmp data was originally stored or media cache?  I think at some point in my history of using Bridge, I selected the option to have cache data in the same folder.

Topaz says they have no idea why it should change, but it is requiring a lot of correctional steps and time for me, and sometimes I don't notice till it's out of order in a gallery, and even more work.

TOPICS
Metadata , Problem or error

Views

335

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Mar 06, 2021 Mar 06, 2021

I much appreciate the involved efforts to help with the coding and all.  I finally figured out why some do revert and others don't, regardless of date, digital or slide scan.  If the metadata, such as description, or keywords are changed in the right panel, that data will always show as current when Bridge is opened.  But if the file is not resaved after such changes, Topaz will go to what it was when previously saved.  So I created a simple action, resave, which opens the chosen ones in a folde

...

Votes

Translate

Translate
Community Expert ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

I don't use Topaz, so I can't help directly. 

 

What file formats?

 

(a) Indirectly, a Bridge script or ExifTool command could reverse the description.

 

(b) A Photoshop script could be created to apply the denoised image pixels to the original file in order to preserve the original metadata.

 

There may be other options as well.

 

It may help to see a few sample images, the pictures could be resized or cropped to 1x1 pixel as it is not about the image, it's all about the metadata.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

I am using tiff files.  When I tried a raw, it converted to dng, and all the data was stripped.  Then I saw I could save as tiff instead, but again all metadata was stripped.  So odd that I can't predict which tiffs will have their descriptions reverted to an earlier form. Maybe if the description was added before or after making a tiff from a RAW file.  So if it was added before it would be saved, while if added to a tiff it wouldn't?  But then it accepted location data added to a tiff and kept, while changing the description.  Weird.

With a Bridge script, could I just select a batch that had name changes (though they are different names) and reverse.  The 2 are separated by double spaces so that when I import chosen metadata into a database, I use 'replace all' double spaces with a tab to get 2 fields for the database.

 

I just looked further down and saw a solution for Lightroom was to save metadata to files.  But in Bridge I only have a metadata menu with a custom 'extract metadata' which I use to import to a database.  Could a script 'save metadata to files' be put here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

In this folder, I went through and changed any that had the old style to the new.  Then I closed Bridge and reopened, thinking maybe since export metadata to folders is checked maybe it would save.  Maybe it's the opposite. The Topaz processed one (with +) reversed and with pair added,

description after.JPG

description before.JPG

  

as well is what came out of the original.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

If the original descriptions have a consistent incorrect pattern as described:

 

DOMESTIC DOG  Canis domesticus

 

 

And the end result should be:

 

Canis domesticus  DOMESTIC DOG

 

 

Then the following regular expression should work:

 

Find:

 

^([A-Z ]+)( {2})([A-Za-z]+ [A-Z a-z]+)

 

 

Replace:

 

$3$2$1

 

 

I'll come back with some code using this regex to correct the description metadata.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 04, 2021 Mar 04, 2021

Copy link to clipboard

Copied

Using ExifTool the command line code would be:

 

 

exiftool -overwrite_original -use MWG '-description<${description;s/^([A-Z ]+)( {2})([A-Za-z]+ [A-Z a-z]+)/$3$2$1/}' -r '/macOS/Path to/file/or folder'

 

 

Note: Windows would use double straight quote marks rather than single straight quotes.

 

It don't have the time to adapt another JavaScript at the moment, I'll come back later...

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

Thanks very much for the suggestion.  In most cases, it just reverses the order, but there was a period where I also added sex, if known to the description.  In such an example case, Canis familiaris  DOMESTIC DOG becomes DOMESTIC DOG Canis familiaris male.  Also I didn't notice at first that the keywords revert to an earlier version also.  Like I had just added a Family subcategory to my Order Anseriformes.  I then went through each folder and assigned all images to the correct child family under the parent Order.  Running through Zenfolio reverted them to only the Order as they were before.  I trying to find a pattern, I had a folder of digital shots from 2018, where no image changed data.  Before that there was a folder of earlier shots where everyone changed.  That was late last night and unfortunately, I can't remember if it was the all scan images from 1993 just before that (I think so) or the one before that, which was 2007, digital.  But I paid careful attention to the latest run and could find no pattern.  All were slide scans.  The 3 from a 1993 shoot all changed.  None of the 3 from 1998 shoot, and from 2000, 2 changed and one didn't.  It does look like the non-changing one had later processing and saving, as the tone differed from the other 2 in the same scene.  Maybe it is a matter of saving after metadata changes.  I will test.

  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2021 Mar 05, 2021

Copy link to clipboard

Copied

I have adjusted a find/replace script from Paul Riggot as I was having problems with modifying other "simpler" script.

 

The Find/Replace fields will be populated with the regular expression posted above, all you need to do is select the files in Bridge, then run the "Custom Replace in Description" script from the Tools menu and press OK without changing the find/replace text.

 

Ensure that you only select the "incorrect" files, running this script on "correct" files will swap the order around to "incorrect".

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

 

// Original script by Paul Riggott
// updated by Stephen Marsh with the find/replace fields preset for a specific text pattern
// https://community.adobe.com/t5/bridge/metadata-changes-problem/td-p/11871617

#target bridge
if (BridgeTalk.appName == "bridge") {
    ReplaceDescription = new MenuElement("command", "Custom Replace in Description", "at the end of tools");
}
ReplaceDescription.onSelect = function () {
    var win = new Window('dialog', 'Custom Replace in Description');
    g = win.graphics;
    var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.2, 0.2, 0.2, 1]); // Darker window colour
    g.backgroundColor = myBrush;
    win.orientation = 'column';
    win.p1 = win.add("panel", undefined, undefined, { borderStyle: "black" });
    win.p1.preferredSize = [380, 100];
    win.g1 = win.p1.add('group');
    win.g1.orientation = "row";
    win.title = win.g1.add('statictext', undefined, 'Custom Replace in Description');
    win.title.alignment = "fill";
    var g = win.title.graphics;
    g.font = ScriptUI.newFont("dialog", "bold", 16);
    win.p6 = win.p1.add("panel", undefined, undefined, { borderStyle: "black" }); //Replace
    win.p6.preferredSize = [380, 100];
    win.g600 = win.p6.add('group');
    win.g600.orientation = "row";
    win.g600.alignment = 'fill';
    win.g600.st1 = win.g600.add('statictext', undefined, 'Find');
    win.g600.st1.preferredSize = [75, 20];
    win.g600.et1 = win.g600.add('edittext', undefined, '^([A-Z ]+)( {2})([A-Za-z]+ [A-Z a-z]+)'); // Preset the find entry
    win.g600.et1.preferredSize = [200, 20];
    win.g610 = win.p6.add('group');
    win.g610.orientation = "row";
    win.g610.alignment = 'fill';
    win.g610.st1 = win.g610.add('statictext', undefined, 'Replace');
    win.g610.st1.helpTip = "Leave this field blank if you want to remove the characters";
    win.g610.st1.preferredSize = [75, 20];
    win.g610.et1 = win.g610.add('edittext', undefined, '$3$2$1'); // Preset the replace entry
    win.g610.et1.preferredSize = [200, 20];
    win.g620 = win.p6.add('group');
    win.g620.orientation = "row";
    win.g620.alignment = 'fill';
    win.g620.cb1 = win.g620.add('checkbox', undefined, 'Global');
    win.g620.cb1.helpTip = "Replace all occurrences of";
    win.g620.cb2 = win.g620.add('checkbox', undefined, 'Case Insensitive');
    win.g620.cb2.value = true;
    win.g620.cb3 = win.g620.add('checkbox', undefined, 'Remove any ()[]');
    win.g620.cb3.value = false;
    win.g1000 = win.p1.add('group');
    win.g1000.orientation = "row";
    win.g1000.alignment = 'center';
    win.g1000.bu1 = win.g1000.add('button', undefined, 'Process');
    win.g1000.bu1.preferredSize = [170, 30];
    win.g1000.bu2 = win.g1000.add('button', undefined, 'Cancel');
    win.g1000.bu2.preferredSize = [170, 30];
    win.g1000.bu1.onClick = function () {
        if (win.g600.et1.text == '') {
            alert("No replace value has been entered!");
            return;
        }
        win.close(0);
        var sels = app.document.selections;
        for (var a in sels) {
            var thumb = sels[a];
            md = thumb.synchronousMetadata;
            if (win.g620.cb1.value && !win.g620.cb2.value) var patt = new RegExp(win.g600.et1.text.toString(), "g");
            if (!win.g620.cb1.value && win.g620.cb2.value) var patt = new RegExp(win.g600.et1.text.toString(), "i");
            if (win.g620.cb1.value && win.g620.cb2.value) var patt = new RegExp(win.g600.et1.text.toString(), "gi");
            if (!win.g620.cb1.value && !win.g620.cb2.value) var patt = new RegExp(win.g600.et1.text.toString());
            md.namespace = "http://purl.org/dc/elements/1.1/";
            var Caption = md.description ? md.description[0] : "";
            if (Caption == "") continue;
            var result = patt.test(Caption.toString());
            if (result == true) {
                var newCaption = Caption.replace(patt, win.g610.et1.text.toString());
                if (win.g620.cb3.value) newCaption = newCaption.replace(/["'\(\)]/g, "");
                setDescription(sels[a].spec, newCaption);
            }
        }
    }
    win.show();
    function setDescription(file, Caption) {
        if (!ExternalObject.AdobeXMPScript) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
        var xmpf = new XMPFile(File(file).fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
        var xmp = xmpf.getXMP();
        xmp.deleteProperty(XMPConst.NS_DC, "description");
        xmp.setLocalizedText(XMPConst.NS_DC, "description", null, "x-default", Caption);
        if (xmpf.canPutXMP(xmp)) {
            xmpf.putXMP(xmp);
        }
        xmpf.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
    }
};

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

LATEST

I much appreciate the involved efforts to help with the coding and all.  I finally figured out why some do revert and others don't, regardless of date, digital or slide scan.  If the metadata, such as description, or keywords are changed in the right panel, that data will always show as current when Bridge is opened.  But if the file is not resaved after such changes, Topaz will go to what it was when previously saved.  So I created a simple action, resave, which opens the chosen ones in a folder and then choose 'save as' with the same name, so nothing changes, then none will revert.  If I just open and save it doesn't change, it has to be 'save as' to be new and saved with the updated metadata.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines