|
8 | 8 |
|
9 | 9 | if __name__ == "__main__": |
10 | 10 | os.makedirs(TARGET_FOLDER, exist_ok=True) |
11 | | - image_path = Path("images/rgb8_512_512_1_0.heic") |
12 | | - heif_image = pillow_heif.open_heif(image_path) |
| 11 | + image_path = Path("images/heif_other/nokia/alpha.heic") |
| 12 | + heif_file = pillow_heif.open_heif(image_path) |
13 | 13 | result_path = os.path.join(TARGET_FOLDER, f"{image_path.stem}.heic") |
14 | | - heif_image.add_thumbnails([256, 372]) |
15 | | - heif_image.save(result_path, quality=35) |
| 14 | + pillow_heif.add_thumbnails(heif_file, [256, 372]) |
| 15 | + heif_file.save(result_path, quality=35) |
16 | 16 |
|
17 | 17 | # Next code will remove thumbnails |
18 | | - heif_image = pillow_heif.open_heif(result_path) |
19 | | - del heif_image[0].thumbnails[0] # remove first thumbnail |
20 | | - del heif_image[0].thumbnails[0] # remove second thumbnail |
| 18 | + heif_file = pillow_heif.open_heif(result_path) |
| 19 | + del heif_file.thumbnails[0] # remove first thumbnail |
| 20 | + del heif_file.thumbnails[0] # remove second thumbnail |
21 | 21 | result_path = os.path.join(TARGET_FOLDER, f"{image_path.stem}_no_thumbs.heic") |
22 | | - heif_image.save(result_path, quality=35) |
| 22 | + heif_file.save(result_path, quality=35) |
0 commit comments