I need to apply crystallized pixels filter to an image via some API or library. This effect should look like this:
So this is not the usual pixel effect, the pixels are not square shaped.
Is there any API I can use? I have been looking for this but I am a bit lost.
2
Answers
Oops, I just noticed you tagged with PHP not Python – sorry! I’ll leave it for now as reference and may do a PHP version another day.
I had a quick attempt at this and it works well enough:
It turns this:
into this:
or this if you go for 500 crystals:
The speed can probably be improved by reducing to 256 colours and a palletised image, finding the nearest colour for each and then simply looking them up in a LUT. Maybe a job for a rainy day…
Keywords: Python, voronoi, crystal, crystallize, Photoshop, filter, image, image processing, Numpy, PIL, Pillow.
Here’s how to apply Crystallize filter with Photoshop api in Python, taken from example https://github.com/lohriialo/photoshop-scripting-python/blob/master/EmbossAction.py