libheif
libheif copied to clipboard
Slow opening of the photo
My iPhone photo opens for about 2s. Other much heavier files open immediately. Will the speed be optimised in the future or is it no longer better?
Can someone post an image example from iPhone that opens in "2 seconds"?
Now there are no files nearby, I asked people, but not yet. Found an old benchmark, it was made by me and the author PhotoQt. https://gitlab.com/lspies/photoqt/-/issues/110
Here are two images in a ZIP file: one in HEIF (slow to open) and the same one converted to JPEG (fast to open). Slow opening comparison.zip
Same issue here, jpg and CR2 raw are fast, instantaneous, while iphone heif takes about 3 seconds to show and makes browsing my library a real pain.
Here are two images in a ZIP file: one in HEIF (slow to open) and the same one converted to JPEG (fast to open). Slow opening comparison.zip
pillow_heif.register_heif_opener()
if __name__ == "__main__":
pillow_heif.options.DECODE_THREADS = 1
start_time = time_ns()
p = "20230117_161524.heic"
im = Image.open(p)
im.load()
print(f"Time: {(time_ns() - start_time) / 1e9}")
exit(0)
Time: 0.677469
pillow_heif.options.DECODE_THREADS = 6
Time: 0.16587
Apple M2
Note: By default libheif uses 4 threads, afaik.
It can be faster, when libheif will have flag to not rotate image or when someone will make a PR with fast rotation implementation.