Nightshade
Joined: 12 Jan 2014
Posts: 1
|
Posted: Sun Jan 12, 2014 9:44 am Post subject: Layer dilation issue |
|
|
I'm trying to set up an automated workflow in Photoshop, and atm I'm stuck with the algoritm.
What I want to achieve:
I want to expand/dilate/grow/bleed each layer one pixel at a time - but only in the case where the area outside the layer is either black or transparent (either one works for me). It should look at the entire document and not just the active layer (although I am open to a solution where the end result is a flattened image. I can separate the colors with a script)
What I've tried:
Various types of blurring and clamping (using for instance, a Levels layer to clamp away the gradient), blurring and posterizing.
I've tried flattening the image, selecting all the padding (black pixels), filled with Content Aware -fill and posterized it back to 2 levels (this results in a jagged edge). I've tried a lot and the thing that gets the closest to what I want to achieve is the "Minimum" filter under "Filter > Other"
I've also tried various select/deselect/intersection algoritms and although these work, they are very slow. In the end I might end up running this operation up to 512 times so having a 10-step selection algoritm that fills and deletes color in the layers is going to be VERY slow.
Problem:
In a composite image, the Minimum filter will eat away the black - just as I want - but it will also blend colors (which I DON'T want).
So for example, a blue area and a red area separated by a 1px row of black will result in the black line turning magenta if I run "Minimum" 1px on it - because the red and the blue blends together.
And if I separate each color into individual layers - as in the workfile below - then there is another issue. Sure I can run Minimum 1px at each layer - one at a time - but then the layer order screws things over, with the top layer occupying more pixels than it should, bleeding over onto other color layers.
You see the problem here? I want to expand out each layer and want them to meet half-ways - eating away either black or transparent pixels - not grow over each other or blend pixels. I've looked at the Custom filter for this but can't come up with a solution that doesn't blend pixels.
This did sound like an easy problem at first but damn this is really starting to annoy me.
Example workfile:
http://www.speedyshare.com/nJESB/example.psd
(press the download link text at the top) |
|