lora-training
lora-training copied to clipboard
ensure HEIC support
by default PIL / python imaging libraries tend to break on HEIC / iphone photos.
This has caused issues in the dreambooth trainers. Perhaps this can be addressed before we share this publically
I assume this can be fixed with pre-processing? Python packages mentioned here https://stackoverflow.com/questions/54395735/how-to-work-with-heic-image-file-types-in-python can be used?
Here's what I did to pre-process my HEIC images, should be simple enough to implement into whatever you're doing
import os from PIL import Image from pillow_heif import register_heif_opener
images_directory = "/path/to/images" content = os.listdir(images_directory)
register_heif_opener()
for file_name in content: if ".heic" in file_name: image = Image.open(images_directory + "/" + file_name) image.save(f"{images_directory}/{file_name.replace('.heic','.jpeg')}", format="jpeg", quality=90) os.remove(f"{images_directory}/{file_name}")