Added pixel_sort example
This commit is contained in:
parent
d55a4aaf08
commit
d24dd7ed2a
4 changed files with 24 additions and 0 deletions
10
README.md
10
README.md
|
@ -6,3 +6,13 @@ Experimental implementations of some destructive image effects in Python
|
|||
|
||||
Those alGoRitHms are designed to work with Pillow.
|
||||
Have a look at [requirements.txt](./requirements.txt)
|
||||
|
||||
## Examples
|
||||
|
||||
### pixel_sort
|
||||
|
||||
 
|
||||
|
||||
Code: [examples/pixel_sort/run.py](./examples/pixel_sort/run.py)
|
||||
|
||||
### more examples coming soon...
|
||||
|
|
BIN
examples/pixel_sort/original.png
Normal file
BIN
examples/pixel_sort/original.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 416 KiB |
BIN
examples/pixel_sort/result.png
Normal file
BIN
examples/pixel_sort/result.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 534 KiB |
14
examples/pixel_sort/run.py
Executable file
14
examples/pixel_sort/run.py
Executable 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")
|
Reference in a new issue