Skip to main content
Inspiring
December 5, 2022
Answered

Filter TIF Images with and without a path

  • December 5, 2022
  • 8 replies
  • 619 views

Hi Everyone,

I was wondering if there's a way to filter in Bridge TIF that contains path in it?

Thanks in advance,

sincerely, Carmelo.

 

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer Stephen Marsh

You're welcome. This is also possible with the command line ExifTool:

 

Conditionally Process If an image has a Photoshop work path/ saved path/clipping path entry, then add an Adobe Bridge Label "Review":

 

exiftool -overwrite_original -if '$workingpath' -label='Review' -execute -overwrite_original -if '$originpathinfo' -label='Review' -common_args -u -r 'system path to input folder'

 

 

 

Conditionally Process If an image has a Photoshop work path/saved path/clipping path entry, moving the processed files to new sub-folders within the source folder:

 

exiftool -if '$workingpath' -directory=%d'Photoshop Work Paths' -execute -if '$originpathinfo' -directory=%d'Photoshop Saved Paths' -common_args -u -r 'system path to input folder'

 

These commands are for the Mac, for Windows, simply change the single straight quotes ' to double straight quotes "

8 replies

Stephen Marsh
Community Expert
Community Expert
December 6, 2022

This one will create collections from clipping paths:

 

// https://raw.githubusercontent.com/Paul-Riggott/PS-Scripts/master/Clipping%20path%20names%20to%20collections.jsx
#target bridge;
   if( BridgeTalk.appName == "bridge" ) {
cpToColls = new MenuElement("command", "Clipping Path to Collections", "at the end of Tools");
}
cpToColls.onSelect = function () {
app.document.deselectAll();
var Thumbs = app.document.getSelection("psd,psb,tif,jpg,eps");
var pathList = new Array();
var pathNames = new Array();
var Name = '';
for (var z in Thumbs){
    Name = getFirstClipPathName(Thumbs[z].spec);
    if(Name != ''){
        $.writeln("Name = " + Name + " length = " + Name.length);
        pathNames.push(Name);
        pathList.push([[Thumbs[z].spec],[Name]]);
        }
    }
pathNames = UniqueList(pathNames);

for(var t=0;t< pathNames.length;t++){
tempArray = new Array();
 for(var p in pathList){
     if(pathList[p][1].toString() == pathNames[t].toString()) tempArray.push(new Thumbnail(File(pathList[p][0])));
     }
 var colls =app.getCollections();
 Found=false;
 for(var k in colls){
     if(colls[k].name.toString() == pathNames[t].toString()){
         app.addCollectionMember(colls[k],tempArray);
         Found=true;
         break;
         }
      }
     if(!Found){
             var newCollection = app.createCollection(pathNames[t].toString());
             app.addCollectionMember(newCollection,tempArray);
             }
    }
function getFirstClipPathName(file){
if(!file.exists) return;
file.open("r");
file.encoding.BINARY;
var dat = file.read();
file.close();
Text='';
if((result = dat.match(/8BIM\x0B\xB7/)) != null) {
ofs = Number(result.index+12);
Text = dat.substr(ofs+1, dat.charCodeAt(ofs));
    }
return Text;
};
function UniqueList(ArrayName){
var unduped = new Object;
for (var i = 0; i < ArrayName.length; i++) {
unduped[ArrayName[i]] = ArrayName[i];
};
var uniques = new Array;for (var k in unduped) {
   uniques.push(unduped[k]);}
return uniques;
};
};
Inspiring
December 7, 2022

OMG; Thanks Stephen_A_Marsh, I was asking this not really expecting it was somehow possible, That will make my workflow much faster Thanks a lot

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
December 7, 2022

You're welcome. This is also possible with the command line ExifTool:

 

Conditionally Process If an image has a Photoshop work path/ saved path/clipping path entry, then add an Adobe Bridge Label "Review":

 

exiftool -overwrite_original -if '$workingpath' -label='Review' -execute -overwrite_original -if '$originpathinfo' -label='Review' -common_args -u -r 'system path to input folder'

 

 

 

Conditionally Process If an image has a Photoshop work path/saved path/clipping path entry, moving the processed files to new sub-folders within the source folder:

 

exiftool -if '$workingpath' -directory=%d'Photoshop Work Paths' -execute -if '$originpathinfo' -directory=%d'Photoshop Saved Paths' -common_args -u -r 'system path to input folder'

 

These commands are for the Mac, for Windows, simply change the single straight quotes ' to double straight quotes "

Stephen Marsh
Community Expert
Community Expert
December 6, 2022

The following script will sort files into folders depending on the path type.

 

// https://forums.adobe.com/message/4470536#4470536
#target bridge
 if( BridgeTalk.appName == "bridge" ) {
clipPaths = MenuElement.create("command", "Sort Clipping Paths", "at the end of Tools","clipping");
}
clipPaths.onSelect = function () {
app.document.deselectAll();
var thumbs = app.document.getSelection("psd, tif, jpg, eps");
var noPath = new Folder(app.document.presentationPath+ '/noPath');
var hasPath = new Folder(app.document.presentationPath+ '/hasPath');
var hasClip = new Folder(app.document.presentationPath+ '/hasClip');
if(!noPath.exists)  noPath.create();
if(!hasClip.exists)  hasClip.create();
if(!hasPath.exists)  hasPath.create();
for(var a in thumbs){
var tempFile = thumbs[a].spec;
var Path = false;
var Clip = false;
tempFile.encoding='BINARY';
tempFile.open('r');
var str= tempFile.read();
tempFile.close();
var pathTag = '8BIM\x07\xd0';
var clippingPathTag = '8BIM\x0b\xb7';
var workPath = '8BIM\x04\x01';
var tagPos =str.match(pathTag);
if(tagPos){
    Path = true;
    tagPos =str.match(clippingPathTag);
    if(tagPos){
        Clip = true;
        }
}
if(!Path){
    if(str.match(workPath)) Path = true;
    }
str = null;
if(!Path) thumbs[a].moveTo(noPath);
if(Path && Clip)  thumbs[a].moveTo(hasClip);
if(Path && !Clip) thumbs[a].moveTo(hasPath);
}
};
Stephen Marsh
Community Expert
Community Expert
December 6, 2022

The following script will rename files containing a path with a leading underscore character.

 

// https://forums.adobe.com/message/10306866#10306866
// Right click on a folder containing Photoshop paths
#target bridge  
NtC = new MenuElement('command', 'Add Underscore to Start of Filename of TIFF with Paths', 'at the end of Thumbnail')  
  
NtC.onSelect = function() {  
     function rec(sF, dst, i) {  
          if (fld = io(sF)) sF = sF.getFiles(); for(; i < sF.length; i++) {  
               if (io(fof = sF[i])) dst.push(fof.name), rec(fof, dst, 0)  
               else if((r = /.tif$/i).test(fof)) {  
                    (function(){  
                         (fle = File(fof)).open('r'), fle.encoding = 'binary'  
                         var r = fle.read(); var p = r.indexOf('8BIM\x04\x01')  
                         if (!(p + 1)) var p = r.indexOf('8BIM\x07\u00D0\x06')  
                         fle.close(); if (p + 1) fof.rename('_' + fof.name)  
                    })()  
               }  
          }  
          return dst  
     }  
  
    function io(v) {return v instanceof Folder}  
    if (len = (sel = (ad = app.document).selections).length) {  
          for(h = 0; h < len; h++) if (io(spec = sel[h].spec)) rec(spec, [], 0)  
    }  
} 

 

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

 

Stephen Marsh
Community Expert
Community Expert
December 6, 2022

@Carmelo5FA3 – A script needs to read the binary data, I'll post some examples from old topics...

 

As an example, here is a topic to find alpha channels:

 

https://community.adobe.com/t5/bridge-discussions/how-to-check-if-image-includes-layers/m-p/11111182

 

Legend
December 6, 2022

Interesting! This works for both TIFF and PSD?

Legend
December 5, 2022

No, Bridge cannot parse TIFF files to find path information.