Exemple #1
0
 def fix_names(self):
     list = os.listdir(self.upscaled_dir)
     for name in list:
         if '[NS-L3][x' + self.scale_factor + '.000000]' in name:
             rename_file(
                 self.upscaled_dir + name, self.upscaled_dir + name.replace(
                     '_[NS-L3][x' + self.scale_factor + '.000000]', ''))
Exemple #2
0
    def fix_names(self):

        list_of_names = os.listdir(self.upscaled_dir)
        for name in list_of_names:
            if '.png.png' in name:
                rename_file(
                    self.upscaled_dir + name,
                    self.upscaled_dir + name.replace('.png.png', '.png'))
Exemple #3
0
    def save_image_quality(self, out_location, quality_per):
        extension = os.path.splitext(os.path.basename(out_location))[1]

        if 'jpg' in extension:
            jpegsave = Image.fromarray(self.frame.astype(np.uint8))
            jpegsave.save(out_location + "temp" + extension,
                          format='JPEG',
                          subsampling=0,
                          quality=quality_per)
            wait_on_file(out_location + "temp" + extension)
            rename_file(out_location + "temp" + extension, out_location)
        else:
            misc.imsave(out_location + "temp" + extension, self.frame)
            wait_on_file(out_location + "temp" + extension)
            rename_file(out_location + "temp" + extension, out_location)
Exemple #4
0
    def fix_names_all(self):

        file_names = []
        for x in range(1, self.frame_count):
            file_names.append("output_" + get_lexicon_value(6, x))

        for file in file_names:
            dirty_name = self.upscaled_dir + file + '_[NS-L' + self.noise_level + '][x' + self.scale_factor + '.000000]' + ".png"
            clean_name = self.upscaled_dir + file + ".png"

            wait_on_either_file(clean_name, dirty_name)

            if file_exists(clean_name):
                pass

            elif file_exists(dirty_name):
                while file_exists(dirty_name):
                    try:
                        rename_file(dirty_name, clean_name)
                    except PermissionError:
                        pass