Skip to content

Commit ace4125

Browse files
authored
Add syntax highlighting
1 parent fb07c8a commit ace4125

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# blurhash-python
2+
```python
3+
import blurhash
4+
import PIL.Image
5+
import numpy
26

3-
import blurhash
4-
import PIL.Image
5-
import numpy
6-
7-
PIL.Image.open("cool_cat_small.jpg")
8-
# Result:
9-
7+
PIL.Image.open("cool_cat_small.jpg")
8+
# Result:
9+
```
1010
![A picture of a cool cat.](/cool_cat_small.jpg?raw=true "A cool cat.")
11-
12-
blurhash.encode(numpy.array(PIL.Image.open("cool_cat_small.jpg").convert("RGB")))
13-
# Result: 'UBL_:rOpGG-oBUNG,qRj2so|=eE1w^n4S5NH'
14-
15-
PIL.Image.fromarray(numpy.array(blurhash.decode("UBMOZfK1GG%LBBNG,;Rj2skq=eE1s9n4S5Na", 128, 128)).astype('uint8'))
16-
# Result:
11+
```python
12+
blurhash.encode(numpy.array(PIL.Image.open("cool_cat_small.jpg").convert("RGB")))
13+
# Result: 'UBL_:rOpGG-oBUNG,qRj2so|=eE1w^n4S5NH'
1714

15+
PIL.Image.fromarray(numpy.array(blurhash.decode("UBMOZfK1GG%LBBNG,;Rj2skq=eE1s9n4S5Na", 128, 128)).astype('uint8'))
16+
# Result:
17+
```
1818
![Blurhash example output: A blurred cool cat.](/blurhash_example.png?raw=true "Blurhash example output: A blurred cool cat.")
1919

2020
Blurhash is an algorithm that lets you transform image data into a small text representation of a blurred version of the image. This is useful since this small textual representation can be included when sending objects that may have images attached around, since it can be used to quickly create a placeholder for images that are still loading or that should be hidden behind a content warning.

0 commit comments

Comments
 (0)