Image compression: Fix spurious zero byte .bak files being created when compressing png images inside epub files

Works around bug in optipng
This commit is contained in:
Kovid Goyal 2015-12-22 09:33:54 +05:30
parent c98dc668ef
commit 67e82c25e1

View File

@ -125,6 +125,11 @@ def run_optimizer(file_path, cmd, as_filter=False, input_data=None):
except EnvironmentError as err: except EnvironmentError as err:
if err.errno != errno.ENOENT: if err.errno != errno.ENOENT:
raise raise
try:
os.remove(outfile + '.bak') # optipng creates these files
except EnvironmentError as err:
if err.errno != errno.ENOENT:
raise
def optimize_jpeg(file_path): def optimize_jpeg(file_path):
exe = get_exe_path('jpegtran') exe = get_exe_path('jpegtran')