def call(self, photo, info, utility): """This is called by the apply method.""" format = info['format'] if format != self.format: raise Exception('%s:\n%s' \ % (LOSSLESS_JPEG_FORMAT_ERROR % format, info['path'])) system.call(utility.get_command_line(self, photo, info['path'], self.get_lossless_filename(photo, info)))
def call(self, photo, info, utility): """This is called by the apply method.""" format = info['format'] if format != self.format: raise Exception('%s:\n%s' \ % (LOSSLESS_JPEG_FORMAT_ERROR % format, info['path'])) system.call( utility.get_command_line(self, photo, info['path'], self.get_lossless_filename(photo, info)))
output = None for index, match in \ enumerate(RE_FILE_OUT.finditer(command)): if index > 0: # only 1 is allowed raise Exception('Only one file_out.* is allowed.') source = match.group() ext = match.group(1) output = system.TempFile(ext, output_filename) command = command.replace(source, system.fix_quotes(output.path)) # tweak command line for source, target in temp_files: command = command.replace(source, system.fix_quotes(target.path)) # execute system.call(command, shell=shell) # give back filename if output and not os.path.exists(output.path): error = True else: error = False for source, target in temp_files: target.close() # os.remove(target) if error: raise Exception( _('Command did not produce an output image:\n%s')\ % command) if output: layer.open(output.path) # DO NOT REMOVE image.load() or output.close will fail on windows layer.image.load()