16 lines
373 B
Python
16 lines
373 B
Python
from PIL import Image
|
|
import pyheif
|
|
|
|
def conv(image_path):
|
|
new_name = image_path.replace('heic', 'png')
|
|
heif_file = pyheif.read(image_path)
|
|
data = Image.frombytes(
|
|
heif_file.mode,
|
|
heif_file.size,
|
|
heif_file.data,
|
|
"raw",
|
|
heif_file.mode,
|
|
heif_file.stride,
|
|
)
|
|
data.save(new_name, "PNG")
|
|
return new_name |