Added pixel_sort example

This commit is contained in:
Julian Müller (ChaoticByte) 2024-01-05 02:27:23 +01:00
parent d55a4aaf08
commit d24dd7ed2a
4 changed files with 24 additions and 0 deletions

View file

@ -6,3 +6,13 @@ Experimental implementations of some destructive image effects in Python
Those alGoRitHms are designed to work with Pillow. Those alGoRitHms are designed to work with Pillow.
Have a look at [requirements.txt](./requirements.txt) Have a look at [requirements.txt](./requirements.txt)
## Examples
### pixel_sort
![](examples/pixel_sort/original.png) ![](examples/pixel_sort/result.png)
Code: [examples/pixel_sort/run.py](./examples/pixel_sort/run.py)
### more examples coming soon...

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 KiB

14
examples/pixel_sort/run.py Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env python3
from sys import path
path.append("../../")
from PIL import Image
from glitch import pixel_sort
from glitch import hsv
if __name__ == "__main__":
img: Image.Image = Image.open("original.png").convert("RGB").rotate(90, expand=True)
pixel_sort(img, limiter=lambda p: hsv(p)[1] < .9, sortkey=lambda p: hsv(p)[0], wrap=True)
img.rotate(-90, expand=True).save("result.png")