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

Find Layered TIFF Files

Community Expert ,
Oct 27, 2015 Oct 27, 2015

Copy link to clipboard

Copied

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?

TOPICS
Scripting

Views

2.7K

Likes

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

Guide , Jan 03, 2016 Jan 03, 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()

...

Likes

Translate

Translate
Adobe Employee ,
Oct 28, 2015 Oct 28, 2015

Copy link to clipboard

Copied

Moving to Bridge Scripting

~Rohit

Likes

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 ,
Nov 08, 2015 Nov 08, 2015

Copy link to clipboard

Copied

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

Likes

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
Guide ,
Jan 03, 2016 Jan 03, 2016

Copy link to clipboard

Copied

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);

    }

};

Likes

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
Guide ,
Jan 03, 2016 Jan 03, 2016

Copy link to clipboard

Copied

Forgot to say, if any layered Tifs are found a Collection is created with all the layered tifs.

Likes

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 ,
Jan 03, 2016 Jan 03, 2016

Copy link to clipboard

Copied

Great Stuff, thanks! I never had any feedback on whether my find solution excluding the keyword “Adobe Photoshop Camera Raw” worked outside of CS6, so it is good to have another method.

Likes

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
Guide ,
Jan 03, 2016 Jan 03, 2016

Copy link to clipboard

Copied

Its always good to have a backup

Likes

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 ,
Aug 17, 2017 Aug 17, 2017

Copy link to clipboard

Copied

For the record, if anybody wishing to do similar via ExifTool, here is a conditional command that will overwrite .TIF files (change the -ext argument to .TIFF if needed rather than .TIF)… In this case adding a Bridge label of “Review” to the layered TIFF images:

Mac OS:

exiftool -r -overwrite_original_in_place -ext .tif -if '$IFD0:ImageSourceData' -label='Review' 'pathToDirectoryOrFile'

Win OS:

exiftool -r -overwrite_original_in_place -ext .tif -if "$IFD0:ImageSourceData" -label="Review" "pathToDirectoryOrFile"

Likes

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 ,
Jul 04, 2018 Jul 04, 2018

Copy link to clipboard

Copied

Another ExifTool option that should be faster for many files is to create a text file listing the layered TIFF files. The input top level folder to scan is called ‘layers’ on the Desktop of the user Stephen Marsh, the text file is to be written to the same user’s Desktop:

 

exiftool -q -ext .tif -if '$IFD0:ImageSourceData' -filename -directory -r '/Users/stephenmarsh/Desktop/layers' > '/Users/stephenmarsh/Desktop/layersoutput.txt'

 

Windows users would swap the straight single quotes for straight double quotes and appropriate file paths.

Likes

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
Contributor ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

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?

Likes

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 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

When Adobe changed the forum software, the previous code was broken as variables in square brackets were lost, i.e. [x] became []. This should hopefully work:

 

 

#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[x];  
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[x]));  
dat=null;  
}  
if(withLayers.length >0){  
var foundFiles = app.createCollection("Tifs With Layers");  
app.addCollectionMember(foundFiles,withLayers);  
    }  
};  

 

  

 

// https://forums.adobe.com/thread/1990912

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

#target bridge
if (BridgeTalk.appName == "bridge") {
    layeredFiles = MenuElement.create("command", "Add Layered TIFF - PSD - PSB to Collection", "at the end of Tools");
}
layeredFiles.onSelect = function () {
    var fileList = Folder(app.document.presentationPath).getFiles(/\.(tif|tiff|psd|psb)$/i);
    withLayers = new Array();
    for (var x in fileList) {
        var file = fileList[x];
        file.open("r");
        file.encoding = 'BINARY';
        var dat = file.read();
        file.close();
        var result;
        var pos = [];
        // var rex = /Adobe Photoshop Document Data Block/g; // Original code from 2016 for layered TIFF
        var rex = /8BIMfxrp/g; // 2020 - "8BIMfxrp" property found using hex editor
        while ((result = rex.exec(dat)) != null) {
            pos.push(result.index + (result[0].length));
        }
        if (pos.length > 0) withLayers.push(new Thumbnail(fileList[x]));
        dat = null;
    }
    if (withLayers.length > 0) {
        var foundFiles = app.createCollection("TIFF - PSD - PSB Files with Layers");
        app.addCollectionMember(foundFiles, withLayers);
    }
};  

 

Likes

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
Contributor ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

THANKS!

 

worked like a charm

 

(bit of a spinning beachball, folder full of some 68 or so TIFFs, +some other files, so I was concerned at first, but it did work)

Likes

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 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

LATEST

That's great news, yes it can be slow, ExifTool would be much faster as it is CLI based and only has to process metadata without all of the overhead found in Bridge.

Likes

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