YassineYousfi commited on
Commit
f78d55d
·
1 Parent(s): d7fff3a

more exceptions?

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -21,11 +21,14 @@ description = '''Explore hiding messages in images using content adaptive stega
21
 
22
  def HILL(input_image, operation, message, key):
23
  tmp_name = str(random.randint(100,500))
24
- input_image.seek(0)
25
- buffer = input_image.read()
26
- I = cv2.imdecode(np.frombuffer(buffer, np.uint8), 1)
27
- I = cv2.cvtColor(I,cv2.COLOR_BGR2GRAY)
28
- cv2.imwrite('tmp/'+tmp_name+'.png',I)
 
 
 
29
 
30
  if operation == 'decode':
31
  try:
 
21
 
22
  def HILL(input_image, operation, message, key):
23
  tmp_name = str(random.randint(100,500))
24
+ try:
25
+ input_image.seek(0)
26
+ buffer = input_image.read()
27
+ I = cv2.imdecode(np.frombuffer(buffer, np.uint8), 1)
28
+ I = cv2.cvtColor(I,cv2.COLOR_BGR2GRAY)
29
+ cv2.imwrite('tmp/'+tmp_name+'.png',I)
30
+ except:
31
+ raise ValueError('Unable to read image')
32
 
33
  if operation == 'decode':
34
  try: