Skip to main content
IcamI
Participating Frequently
January 20, 2021
Question

HELP! How to automatically split a layer into multiple new ones

  • January 20, 2021
  • 2 replies
  • 1197 views

Okay, so I have a solid & void plan of a town. The buildings are solid black while the rest of the layer is transparent. I want to be able to isolate each building into their own separate layer, it would take way too long to use the standard lasso selection tools so I'm looking for a quicker method.

 

Bonus points if anyone knows a way of automatically arranging these isolated buildings into size order.

 

Thank you in advance for any help

 

This topic has been closed for replies.

2 replies

c.pfaffenbichler
Community Expert
Community Expert
January 20, 2021

»I want to be able to isolate each building into their own separate layer«

Sounds like a task more fit for vector editing, for example vectorizing the image in Illustrator and then using the individual paths instead of Layers. 

 

But it might be possible to automate the task in Photoshop if the elements have enough empty space between them. 

https://community.adobe.com/t5/photoshop/isolating-groups-of-pixels/m-p/4042904?page=1

https://photoshopscripts.wordpress.com/2012/12/09/split-to-layers/

IcamI
IcamIAuthor
Participating Frequently
January 20, 2021

Thank you, i'll give this a try! 🙂

c.pfaffenbichler
Community Expert
Community Expert
January 20, 2021

»a way of automatically arranging these isolated buildings into size order.«

What were you trying to say with this exactly? 

Edit: Arrange in the Layers Stack or arrange on the Canvas, and if the latter: how? 

IcamI
IcamIAuthor
Participating Frequently
January 20, 2021

Hey! thank you for your repy 🙂

I am less concerned about this part but what i meant is that if i had a layer for each building (so varying sizes and shapes of solid black boxes on a transparent background), does photoshop have a way of arranging these layers on the page in order of their size?

Please excuse my lack of photoshop terminology, id still consider myself a beginner.

c.pfaffenbichler
Community Expert
Community Expert
January 20, 2021

No, there is no default functionality for this. 

But again a Script might be created to achieve this.

The number of pixels in a Layer could be determined via the Histogram of its transparency, an Array of the areas, height, width and LayerID created and sorted; then one would need to set rules for the arrangement. 

 

But this would likely be a fairly slow process.