Copy link to clipboard
Copied
Hi
I often have 1000s of photos in a folder, some with white borders and some without. I'd like to be able to run a script that would check and move the bordered photos to another directory.
I've searched the community (and the interweb) but the results get clouded with methods for creating white borders so I've not had any luck finding a discussion that might help me. Has anyone seen a post or script that could help me.
Thanks in advance for any help/advice that can be given, Leo
Originally I wanted to suggest exactly 4 corners as well, but then realised maybe it's not needed if the rest of images wouldn't be white in first corner. The below code save in .jsx format to: C:\Program Files\Common Files\Adobe\Startup Scripts CC\Adobe Bridge 2021
fourWhiteCorners = new MenuElement('command', 'White Corners',
'at the end of Thumbnail'), fourWhiteCorners.onSelect = function() {
Folder(fldr = (pp = app.document.presentationPath) + '/wht/' ).create()
fls = [].slice.call(File(
...
In new, accelerated version change:
bd = new BitmapData(shft = fls.shift())
for(j = 0; j < (arr1 = [0, bd.height]).length; j++) {
for(i = 0; i < (arr2 = [0, bd.width]).length; i++) {
if (bd.getPixel(arr2[i], arr1[j]) - 16777215) continue lab
}
}
to:
bd = new BitmapData(shft = fls.shift()), arr = [[0, hh = (h = bd.height)
/ 2], [wh = (w = bd.width) / 2, 0], [wh, h], [w, hh]]; while(arr.length) {
if (bd.getPixel((cell = arr.shift())[0], cell[1]) - 16777215) continue lab
}
Copy link to clipboard
Copied
Make selection on canvas and check histogram for document.
Copy link to clipboard
Copied
Thank you, I was looking for an equivalent of the GUI where one can select the entire image vs. selecting the active layer, but the selection is perfect!
Copy link to clipboard
Copied
You may make visible only specific layer and check document histogram, or make its selection additionally if not all pixels are opaque. It is possible to check histogram for specific channels.
Copy link to clipboard
Copied
Thank you, I went with the selection option using a 1px border selection from the canvas edge. The mean histogram value is then checked if it equals 255 or not. Thanks for helping me work through this exercise, I have learnt some new things!