Do you sometimes get the message "This file format is not supported"? I was there. So I created a conversion program in python. I hope it helps someone.
from PIL import Image
import pyheif
heif_file = pyheif.read(image_path) # 1
data = Image.frombytes(             # 2
    heif_file.mode, 
    heif_file.size, 
    heif_file.data,
    "raw",
    heif_file.mode,
    heif_file.stride,
    )
image = data.resize(size)           # 3
image.save(save_path, "PNG")        # 4
――It's easy, so if you have a lot of HEIC data, it's a good idea to make the above code a function and read it all at once with glob etc.!
-Pyheif's github -Pillow Official
Recommended Posts