Selection by layer content bounds

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

gussent

Selection by layer content bounds

Post by gussent »

Hi!

Is there a way to auto-select (auto-detect bounds) an image inside of a layer, placed on a solid color background? The goal is to quickly select object and than crop and save. Currently, I do it manually, but it takes a time.



I spent a lot of time to find a script. Also I tried to write it by myself, but using of color sampler turned out too slow.

Any ideas?

UPD: I found a similar behavior on «Trim ...» menu command. Unless it crops right away and a result image is not a square.

Best regards,
Dmitry

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

txuku

Selection by layer content bounds

Post by txuku »

Bonjour gussent

I think you can do it with a script .atn :

Menu select/Color range... Tolerance=0 White
Menu select/Inverse

Layer/New/Layer via copy

Hide Background

Menu Image/Crop
Color....

MergeVisible Background
Flatten Image