Spaces:
Running
Running
Update utils.py
Browse files
utils.py
CHANGED
@@ -1,5 +1,18 @@
|
|
1 |
import cv2
|
2 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
def to_bin(data):
|
4 |
"""Convert `data` to binary format as string"""
|
5 |
if isinstance(data, str):
|
|
|
1 |
import cv2
|
2 |
import numpy as np
|
3 |
+
from PIL import Image, PngImagePlugin
|
4 |
+
|
5 |
+
def test_roundtrip_text(im_name,extra):
|
6 |
+
# Check text roundtripping
|
7 |
+
|
8 |
+
im = Image.open(im_name)
|
9 |
+
|
10 |
+
info = PngImagePlugin.PngInfo()
|
11 |
+
info.add_text("TXT", extra)
|
12 |
+
im.save("test","png",pnginfo=info)
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
def to_bin(data):
|
17 |
"""Convert `data` to binary format as string"""
|
18 |
if isinstance(data, str):
|