321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
image.save(out, "PNG", quality=98)
imgdata = out.getvalue()
except Exception as e:
#traceback.print_exc()
return log.ERR("favicon/logo conversion error:", e) and False
else:
log.WARN("Couldn't detect valig image type from its raw content")
# PNG already?
if re.match(b"^.(PNG)", imgdata):
try:
with open(fn, "wb") as f:
f.write(imgdata)
return True
|
|
|
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
image.save(out, "PNG", quality=98)
imgdata = out.getvalue()
except Exception as e:
#traceback.print_exc()
return log.ERR("favicon/logo conversion error:", e) and False
else:
log.WARN("Couldn't detect valid image type from its raw content")
# PNG already?
if re.match(b"^.(PNG)", imgdata):
try:
with open(fn, "wb") as f:
f.write(imgdata)
return True
|