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

How to check if image includes layers?

Explorer ,
May 06, 2020 May 06, 2020

Copy link to clipboard

Copied

hej,

 

is it possible in bridge to check if a tiff or psd file includes layers or alpha channels, without opening the file in PS?

 

thank you,

anders

TOPICS
How to

Views

2.7K

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 2 Correct answers

Community Expert , May 07, 2020 May 07, 2020

Standing on the shoulders of giants, I hacked this for layered TIF, PSD, PSB:

 

 

// 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?
*/

// TIFF - PSD - PSB Files with Layers to Collection.jsx

#target bridge
if (BridgeTalk.appName == "bridge") {
    layeredFiles = MenuElement.create("command", "Add Layered TIFF - PSD - PSB to Collection", "at the end of Tools");
}
layeredF
...

Votes

Translate

Translate
Community Expert , May 07, 2020 May 07, 2020

And here is one for alpha & spot channels:

 

 

// 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?
*/

// TIFF - PSD - PSB Files with Alpha or Spot Channels to Collection.jsx

#target bridge
if (BridgeTalk.appName == "bridge") {
    alphaFiles = MenuElement.create("command", "Add TIFF - PSD - PSB Files with Alpha or Spot Channels to Collection", "at the end of Tools");
}
alp
...

Votes

Translate

Translate
Community Expert ,
May 06, 2020 May 06, 2020

Copy link to clipboard

Copied

I believe that the following script was from SuperMerlin, it is only for layered TIFF files. I am not sure how hard it would be to extend to PSD/PSB or to look for alpha channels.

 

 

// https://forums.adobe.com/thread/1990912
#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|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 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);
    }
};  

 

 

 

Prepression - Downloading and Installing Adobe Scripts

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 ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Standing on the shoulders of giants, I hacked this for layered TIF, PSD, PSB:

 

 

// 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?
*/

// TIFF - PSD - PSB Files with Layers to Collection.jsx

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

 

 

 

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 ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

And here is one for alpha & spot channels:

 

 

// 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?
*/

// TIFF - PSD - PSB Files with Alpha or Spot Channels to Collection.jsx

#target bridge
if (BridgeTalk.appName == "bridge") {
    alphaFiles = MenuElement.create("command", "Add TIFF - PSD - PSB Files with Alpha or Spot Channels to Collection", "at the end of Tools");
}
alphaFiles.onSelect = function () {
    var fileList = Folder(app.document.presentationPath).getFiles(/\.(tif|tiff|psd|psb)$/i);
    withAlphas = 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 = /Alpha |Spot Color /g; // 2020 - "Alpha " & "Spot Color " property found using hex editor
        while ((result = rex.exec(dat)) != null) {
            pos.push(result.index + (result[0].length));
        }
        if (pos.length > 0) withAlphas.push(new Thumbnail(fileList[x]));
        dat = null;
    }
    if (withAlphas.length > 0) {
        var foundFiles = app.createCollection("TIFF - PSD - PSB Files with Alpha or Spot Channels");
        app.addCollectionMember(foundFiles, withAlphas);
    }
};  

 

 

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 ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Thank you SuperMerlin!

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
Explorer ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Wow! You are a hero! These scripts will help me a lot! Thank you!

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 ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Thank you, however, I'm just standing in SuperMerlin's shadow.

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
Contributor ,
May 25, 2023 May 25, 2023

Copy link to clipboard

Copied

LATEST

These scripts crash Bridge 2022+. Anyone know a fix?

Thanks,

Shangara.

Photographer | Shangara.me

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