Skip to content

Commit 0e05787

Browse files
committed
Beginnings of an actual readme.
1 parent 3a8abb9 commit 0e05787

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
# blurhash-python
2-
Implementation of the blurhash algorithm in pure python
2+
3+
import blurhash
4+
import PIL.Image
5+
import numpy
6+
7+
PIL.Image.open("cool_cat_small.jpg")
8+
# Result:
9+
![A picture of a cool cat.](/cool_cat_small.png?raw=true "A cool cat.")
10+
11+
blurhash.encode(numpy.array(PIL.Image.open("cool_cat_small.jpg").convert("RGB")))
12+
# Result: 'UBL_:rOpGG-oBUNG,qRj2so|=eE1w^n4S5NH'
13+
14+
PIL.Image.fromarray(numpy.array(blurhash.decode("UBMOZfK1GG%LBBNG,;Rj2skq=eE1s9n4S5Na", 128, 128)).astype('uint8'))
15+
# Result:
16+
![Blurhash example output: A blurred cool cat.](/blurhash_example.png?raw=true "Blurhash example output: A blurred cool cat.")
17+
18+
This is a pure-python implementation of the blurhash algorithm in pure python, closely following the original swift implementation by Dag Ågren.

blurhash_example.png

8.13 KB
Loading

cool_cat_small.jpg

4.58 KB
Loading

0 commit comments

Comments
 (0)