mirror of
https://github.com/simon987/chan_feed.git
synced 2025-04-19 02:06:42 +00:00
image processing error handling
This commit is contained in:
parent
5441ea0809
commit
589e578473
@ -47,9 +47,6 @@ def image_meta(url, url_idx, web):
|
|||||||
try:
|
try:
|
||||||
f = BytesIO(buf)
|
f = BytesIO(buf)
|
||||||
im = Image.open(f)
|
im = Image.open(f)
|
||||||
except Exception as e:
|
|
||||||
logger.warning("exception during image open: " + str(e))
|
|
||||||
return None
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
"url": url_idx,
|
"url": url_idx,
|
||||||
@ -64,6 +61,9 @@ def image_meta(url, url_idx, web):
|
|||||||
"ahash": b64hash(imagehash.average_hash(im, hash_size=12), 18),
|
"ahash": b64hash(imagehash.average_hash(im, hash_size=12), 18),
|
||||||
"whash": b64hash(imagehash.whash(im, hash_size=8), 8),
|
"whash": b64hash(imagehash.whash(im, hash_size=8), 8),
|
||||||
}
|
}
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("exception during image post processing: " + str(e))
|
||||||
|
return None
|
||||||
|
|
||||||
del im, r, buf
|
del im, r, buf
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user