mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44: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:
|
||||
return raw
|
||||
else:
|
||||
try:
|
||||
sz = os.path.getsize(outfile)
|
||||
except EnvironmentError:
|
||||
sz = 0
|
||||
if sz < 1:
|
||||
return raw
|
||||
shutil.copystat(file_path, outfile)
|
||||
atomic_rename(outfile, file_path)
|
||||
finally:
|
||||
|
Loading…
x
Reference in New Issue
Block a user