Omnibus commited on
Commit
6a798f4
·
1 Parent(s): 23f56a9

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +4 -2
utils.py CHANGED
@@ -1,3 +1,4 @@
 
1
  def to_bin(data):
2
  """Convert `data` to binary format as string"""
3
  if isinstance(data, str):
@@ -34,8 +35,9 @@ def decode(image_name,txt=None):
34
 
35
  def encode(image_name, secret_data,txt=None):
36
  msg=""
37
- BGRimage = cv2.imread(image_name)
38
- image = cv2.cvtColor(BGRimage, cv2.COLOR_BGR2RGB)
 
39
  n_bytes = image.shape[0] * image.shape[1] * 3 // 8
40
  print("[*] Maximum bytes to encode:", n_bytes)
41
  secret_data1=secret_data
 
1
+ from PIL import Image
2
  def to_bin(data):
3
  """Convert `data` to binary format as string"""
4
  if isinstance(data, str):
 
35
 
36
  def encode(image_name, secret_data,txt=None):
37
  msg=""
38
+ #BGRimage = cv2.imread(image_name)
39
+ #image = cv2.cvtColor(BGRimage, cv2.COLOR_BGR2RGB)
40
+ image = Image.open(image_name)
41
  n_bytes = image.shape[0] * image.shape[1] * 3 // 8
42
  print("[*] Maximum bytes to encode:", n_bytes)
43
  secret_data1=secret_data