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

Bridge (or Photoshop) script to check JPGs and move the JPGs with a white border to another folder

Participant ,
Jul 04, 2021 Jul 04, 2021

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

TOPICS
Batch , How to , Scripting

Views

1.2K

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

LEGEND , Jul 04, 2021 Jul 04, 2021

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(
...

Votes

Translate

Translate
LEGEND , Jul 05, 2021 Jul 05, 2021

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
}

 

Votes

Translate

Translate
LEGEND ,
Jul 05, 2021 Jul 05, 2021

Copy link to clipboard

Copied

Make selection on canvas and check histogram for document.

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 ,
Jul 05, 2021 Jul 05, 2021

Copy link to clipboard

Copied

@Kukurykus 

 

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!

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
LEGEND ,
Jul 05, 2021 Jul 05, 2021

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.

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 ,
Jul 05, 2021 Jul 05, 2021

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!

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