Copy link to clipboard
Copied
Hey All!
From time to time it comes up that I have an image of random shapes (in this case stars) that are not completely round, but more randomly shaped, which makes them in this case look more like snowflakes.
I'm trying to find a way to locate all the stars and place a dot on top of them with roughly the same size of the original star. Or find another way to make the existing stars completely round. I used edge detection to separate the stars from the background, so that they are 100% white to make it easier.
Has someone any ideas on how to do that with Photoshop, After Effects, Illustrator or any other software that may have a feature that can be used, or partially used to solve the problem?
If someone does not have a full solution, but just some thoughts, please still post them. Maybe it already helps. 🙂
I've attached an example image of what I'm talking about.
That's a very good idea with the symbol replace script. Thanks a lot! While searching for that I found something similar that does exactly what I need here: http://illustrator.hilfdirselbst.ch/dokuwiki/en/skripte/javascript/zamena_size
I've also tried the "Find and Replace Graphics" script here: http://kelsocartography.com/scripts/#nvk
Also similar, but it's not quite what I need, since it strechtes in X and Y direction which results in ellipses rather than circles. But I've included it here in
...Oh true it is suprisingly short!
I tried many different keywords. I think something like "illustrator replace shape" got me to this result.
It got me to this thread where both scripts were linked to by other users:
Here is everything I did in order. Also for me as a reminder since I don't use Illustrator much:
Preparation:
1. vectorize the image with Properties > Image Trace
2. play with settings
...Copy link to clipboard
Copied
I know no currently available method to truly and effectively achieve this.
Overlapping »clusters« (see screenshot) make it difficult to determine individual objects/centers.
Copy link to clipboard
Copied
Yes true the touching shapes are problematic, but if it would count them as one dot, that would already be better than nothing. Then I could manually adjust them later on if some happen to be to big.
Thanks for the input regardless!
Copy link to clipboard
Copied
In that case I think there might be options, though not necessarily speedy ones.
Illustrator or After Effects might offer better ones, but in Photoshop one could use a Script to create a Work Path based on the image loaded as a Selection, then evaluate all the subPathItems (approximate a center and a »width« if not an actual »radius«) and create a Path with circular supPathItems.
Maybe someone else has a better idea?
Copy link to clipboard
Copied
Maybe something like that would work. Unfortunately I don't have enough knowledge of scripting to do that.
But thanks for the idea!
Copy link to clipboard
Copied
If we use paths to find closed contours, then I'm afraid that a significant part of the stars 1-2 pixels in size will be lost.
Copy link to clipboard
Copied
They won't if you cut out those you made paths from and then use Color Range on the rest to expand their selection size a little. Finally you change them to paths, so you save each pixel! 🙂
Copy link to clipboard
Copied
I actually first tried the "Auto-trace" feature in After Effects today, which worked perfectly in the preview and managed to get all the stars, but when clicking OK it filled 64gb of ram and then crashed. Then I thought, well Illustrator is basically made for this so why do I use After Effects and yes, Illustrator got them all and I now have a vector version of it. It found close to 10000 individual paths, so that's probably the reason After Effects crashed.
Illustrator even has a way to replace the shapes with ellipses under "Effects > Convert to Shape", but those are unfortunately not really round and sometimes way bigger than the original shape (outlined in blue).
so close..
Pixxxelschubsers comment down below then guided me into the right direction to find exactly what I need.
Thanks a lot for the discussions here in this thread!
Copy link to clipboard
Copied
Try to use the "Illustrator way" with a Replace with symbol script.
Copy link to clipboard
Copied
That's a very good idea with the symbol replace script. Thanks a lot! While searching for that I found something similar that does exactly what I need here: http://illustrator.hilfdirselbst.ch/dokuwiki/en/skripte/javascript/zamena_size
I've also tried the "Find and Replace Graphics" script here: http://kelsocartography.com/scripts/#nvk
Also similar, but it's not quite what I need, since it strechtes in X and Y direction which results in ellipses rather than circles. But I've included it here in case someone stumbles across this thread and it works better for their needs.
Thanks a lot everyone in this thread!
Copy link to clipboard
Copied
I wonder what keywords you used on 'google' when trying to find these scripts? btw the script you used is very short, is it everything what has to be done in Illustrator, run it on an image?
mySelection = activeDocument.selection
if (mySelection.length > 0) {
if (mySelection instanceof Array) {
goal = mySelection[0]
centerPoint = goal.position[0] + (goal.width / 2)
centerPointVert = goal.position[1] - (goal.height / 2)
for(i = 1; i < mySelection.length; i++) {
currItem = mySelection[i]
centerPoint = currItem.position[0] + (currItem.width / 2)
centerPointVert = currItem.position[1] - (currItem.height / 2)
ratio = 100 / (goal.width / currItem.width)
ratioV = 100 / (goal.height / currItem.height)
newItem = goal.duplicate()
newItem.position = Array((centerPoint - (goal.width / 2)), (centerPointVert + (goal.height / 2)))
if (ratio < ratioV) newItem.resize(ratio, ratio, true, true, true, true, ratio)
else newItem.resize(ratioV, ratioV, true, true, true, true, ratioV)
newItem.artworkKnockout = currItem.artworkKnockout
newItem.clipping = currItem.clipping
newItem.isIsolated = currItem.isIsolated
newItem.evenodd = currItem.evenodd
if (currItem.polarity) newItem.polarity = currItem.polarity
newItem.moveBefore(currItem)
currItem.remove()
}
}
}
Copy link to clipboard
Copied
Oh true it is suprisingly short!
I tried many different keywords. I think something like "illustrator replace shape" got me to this result.
It got me to this thread where both scripts were linked to by other users:
Here is everything I did in order. Also for me as a reminder since I don't use Illustrator much:
Preparation:
1. vectorize the image with Properties > Image Trace
2. play with settings to get it more accurate
Using the script:
1. create a circle (every selected shape will be replace with this circle)
2. select all objects that should be replaced
3. then select the circle (the replacement) last
4. go to file > scripts > zamena_size
(available here: http://illustrator.hilfdirselbst.ch/dokuwiki/en/skripte/javascript/zamena_size)
5. done! In my case it took a few minutes due to the thousands of stars.
The other script works the same way.