mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Image compression: If the compression tools return a zero byte image ignore it and use the original image
This commit is contained in:
parent
6abc3a55ca
commit
4d78cc9f1a
@ -105,6 +105,12 @@ def run_optimizer(file_path, cmd, as_filter=False, input_data=None):
|
|||||||
if p.wait() != 0:
|
if p.wait() != 0:
|
||||||
return raw
|
return raw
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
sz = os.path.getsize(outfile)
|
||||||
|
except EnvironmentError:
|
||||||
|
sz = 0
|
||||||
|
if sz < 1:
|
||||||
|
return raw
|
||||||
shutil.copystat(file_path, outfile)
|
shutil.copystat(file_path, outfile)
|
||||||
atomic_rename(outfile, file_path)
|
atomic_rename(outfile, file_path)
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user