def conv(heic_path, save_dir, filetype, quality): # ±£´æÏȤΥǥ£¥ì¥¯¥È¥ê¤È¥Õ¥¡¥¤¥ëÃû extension = "." + filetype save_path = save_dir / filetype / pathlib.Path(*heic_path.parts[1:]).with_suffix(extension) # ¥Õ¥©¥ë¥À×÷³É save_path.parent.mkdir(parents=True, exist_ok=True) # HEIC¥Õ¥¡¥¤¥ëpyheif¤ÇÕi¤ßÞz¤ß heif_file = pyheif.read(heic_path) # Õi¤ßÞz¤ó¤À¥Õ¥¡¥¤¥ë¤ÎÖÐÉí¤òdata‰äÊý¤Ø data = Image.frombytes( heif_file.mode, heif_file.size, heif_file.data, "raw", heif_file.mode, heif_file.stride, ) # JPEG¤Ç±£´æ data.save(save_path, quality=quality) print("±£´æ£º", save_path)