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

Bridge Script to Add Missing Resolution Metadata to Exported JPEG Files

Community Expert ,
Nov 19, 2022 Nov 19, 2022

Copy link to clipboard

Copied

This script will add 300ppi resolution metadata to selected JPEG files (JPG or JPEG extensions). This may be desired when making use of Photoshop's Export features which are designed to strip irrelevant metadata that is not required for web/device viewing. Some users still wish to have the resolution metadata included, but do not wish to use Save As/Save As a Copy which includes all metadata.

 

This is a continuation of the topic in the Photoshop forum where I created a couple of similar scripts for Photoshop:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-add-missing-resolution-meta...

 

/*
Set JPEG Resolution Metadata to 300ppi.jsx
v1.0, 19th November 2022, Stephen Marsh
Add the stripped resolution metadata back to exported JPEG files
https://community.adobe.com/t5/bridge-discussions/bridge-script-to-add-missing-resolution-metadata-to-exported-jpeg-files/td-p/13357144
*/

#target bridge

if (BridgeTalk.appName == "bridge") {
    addResMeta = new MenuElement("command", "Set JPEG Resolution Metadata to 300ppi", "at the end of Tools");
}

addResMeta.onSelect = function () {

    //var sels = app.document.selections;
    var sels = app.document.getSelection("jpg, jpeg");

    for (var i = 0; i < sels.length; i++) {
        var thumb = sels[i];
        var md = thumb.metadata;
        var res = 300;

        md.namespace = "http://ns.adobe.com/photoshop/1.0/";
        md.XResolution = res;
        md.namespace = "http://ns.adobe.com/photoshop/1.0/";
        md.DisplayedUnitsX = 'inches';
        md.namespace = "http://ns.adobe.com/photoshop/1.0/";
        md.YResolution = res;
        md.namespace = "http://ns.adobe.com/photoshop/1.0/";
        md.DisplayedUnitsY = 'inches';

        md.namespace = "http://ns.adobe.com/tiff/1.0/";
        md.XResolution = res;
        md.namespace = "http://ns.adobe.com/tiff/1.0/";
        md.YResolution = res;
        md.namespace = "http://ns.adobe.com/tiff/1.0/";
        md.ResolutionUnit = 2;

        // Appears to be a bug that this doesn't work as expected when called from a script
        //app.document.chooseMenuItem("PurgeCacheForSelected");
    }
    // Prompt user to purge cache for the folder (to force an update of the displayed metadata for all files)
    app.document.chooseMenuItem("PurgeCache");
}

 

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

 

TOPICS
Metadata , Scripting

Views

138

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
no replies

Have something to add?

Join the conversation