imageio, it's convenient, isn't it?
I wanted to save the image processed data (image) in 8bit or 16bit with lossless compression, so I saved the image with imageio.imwrite
in PNG, but for some reason I thought that the script was heavy, but PNG writing It was extremely late.
https://github.com/imageio/imageio/issues/387
It takes about 1 second for an image of about 256x256, and about 0.05 seconds for an uncompressed image with BMP or TIFF.
cv2.imwrite might be faster ...?
After that, it may be faster with the latest imageio (PIL).
For natural image data, lossless compression does not reduce the storage so much, so it is best to give up compression and use BMP or TIFF (8bit, 16bit, 32bit).
By the way, if you save 16bit PNG with imwrite, it will be automatically set to 8bit if the input image data is in the range of [0, 255]
unless you add the PNG-FI
option.
Recommended Posts