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
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
...
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
...
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);
}
};
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);
}
};
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);
}
};
Copy link to clipboard
Copied
Thank you SuperMerlin!
Copy link to clipboard
Copied
Wow! You are a hero! These scripts will help me a lot! Thank you!
Copy link to clipboard
Copied
Thank you, however, I'm just standing in SuperMerlin's shadow.
Copy link to clipboard
Copied
These scripts crash Bridge 2022+. Anyone know a fix?
Thanks,
Shangara.