Skip to main content
Stephen Marsh
Community Expert
Community Expert
October 28, 2015
Answered

Find Layered TIFF Files

  • October 28, 2015
  • 2 replies
  • 5183 views

Is there a way to find layered TIFF files in Bridge (or another method, perhaps scripting Bridge/Photoshop)?

This came up on another forum, where layered TIFF files may be accidentally saved when they should be layered PSD for this workflow.

The best that I have been able to do is use the Bridge FIND command to search all metadata excluding the keyword “Adobe Photoshop Camera Raw” as it appears that in CS6, a flat TIFF contains this phrase in XMP metadata, while a layered TIFF does not. Text layers can be found using the metadata keyword “layers”, however this does not find pixel or adjustment layers.

There are alternative options with ExifTool or ImageMagick/GraphicsMagick, however I was looking for a “standard” Adobe option.

Any ideas?

This topic has been closed for replies.
Correct answer SuperMerlin

Here is a Bridge script, to be placed in the folder (Preferences-Startup Scripts (Reveal My Startup Scripts))

#target bridge 

   if( BridgeTalk.appName == "bridge" ) { 

tifLayers= MenuElement.create("command", "Tifs With Layers", "at the end of Tools");

}

tifLayers.onSelect = function () {

var fileList = Folder(app.document.presentationPath).getFiles("*.tif");

withLayers = new Array();

for(var x in fileList){

var file = fileList;

file.open("r");

file.encoding = 'BINARY';

var dat = file.read();

file.close();

var result;

var pos = [];

var Text= [];

var rex = /Adobe Photoshop Document Data Block/g;

while ((result = rex.exec(dat)) != null) {

pos.push(result.index+(result[0].length));

}

if(pos.length>0) withLayers.push(new Thumbnail(fileList));

dat=null;

}

if(withLayers.length >0){

var foundFiles = app.createCollection("Tifs With Layers");

app.addCollectionMember(foundFiles,withLayers);

    }

};

2 replies

Stephen Marsh
Community Expert
Community Expert
November 8, 2015

Sad that there is no “Adobe” way to do this.

Apparently there is a relatively easy Mac OS/Unix way to do this, however I can’t take credit for the following shell script code (not sure if this would work in Windows using say Cygwin or similar):

#!/bin/bash

TIFFEXTENSIONONLY=0

cd "$(dirname "${BASH_SOURCE[0]}")"

SAVEIFS=$IFS

IFS=$(/bin/echo -n $'\n\b')

if [[ TIFFEXTENSIONONLY -eq 0 ]]; then

for N in $(find . -maxdepth 1 -type f ! -name '._*'); do

if [[ $(head -c 2 "$N") == II ]] || [[ $(head -c 2 "$N") == MM ]]; then

tiffutil -dump "$N" | grep '^37724 (0x935c)' > /dev/null

if [[ $? -eq 0 ]]; then

mkdir -p 'MULTIPLE LAYERS'

mv -n "$N" 'MULTIPLE LAYERS'

fi

fi

done

else

for N in $(find -E . -maxdepth 1 -iregex '.*tif(f){0,1}' ! -name '._*'); do

if [[ $(head -c 2 "$N") == II ]] || [[ $(head -c 2 "$N") == MM ]]; then

tiffutil -dump "$N" | grep '^37724 (0x935c)' > /dev/null

if [[ $? -eq 0 ]]; then

mkdir -p 'MULTIPLE LAYERS'

mv -n "$N" 'MULTIPLE LAYERS'

fi

fi

done

fi

IFS=$SAVEIFS

echo TIFF layer checking finished $(date)

Original topic thread here:

printplanet.com/forum/prepress-and-workflow/adobe/248476-identifying-layered-tifs-in-indesign

SuperMerlin
SuperMerlinCorrect answer
Inspiring
January 3, 2016

Here is a Bridge script, to be placed in the folder (Preferences-Startup Scripts (Reveal My Startup Scripts))

#target bridge 

   if( BridgeTalk.appName == "bridge" ) { 

tifLayers= MenuElement.create("command", "Tifs With Layers", "at the end of Tools");

}

tifLayers.onSelect = function () {

var fileList = Folder(app.document.presentationPath).getFiles("*.tif");

withLayers = new Array();

for(var x in fileList){

var file = fileList;

file.open("r");

file.encoding = 'BINARY';

var dat = file.read();

file.close();

var result;

var pos = [];

var Text= [];

var rex = /Adobe Photoshop Document Data Block/g;

while ((result = rex.exec(dat)) != null) {

pos.push(result.index+(result[0].length));

}

if(pos.length>0) withLayers.push(new Thumbnail(fileList));

dat=null;

}

if(withLayers.length >0){

var foundFiles = app.createCollection("Tifs With Layers");

app.addCollectionMember(foundFiles,withLayers);

    }

};

Inspiring
March 2, 2021

Hi, I'm just finding this thread years later, and I've gotten the above script installed but nothing appears to work when I run it.

 

I'm using the CC 2019 version of Bridge. I have a test folder full of tiffs, some layered, some not. I'm selecting the script from the Tools menu yet it's either not running or it's failing to find any layered tiffs.

 

Is there something I'm missing?

rpandita
Community Manager
Community Manager
October 28, 2015

Moving to Bridge Scripting

~Rohit