CLImage
CLImage copied to clipboard
[REQUEST] Load image from bytes
I think it would be better if the library exposes a function to load images directly from bytes instead of reading from a file. For example, downloading images from API, so I don't have to write image data to file locally.
You can use BytesIO from the io standard library to create a file in memory
import requests
from io import BytesIO
import climage
def main():
r = requests.get("image_url")
with BytesIO(r.content) as img:
print(climage.convert(img))
if __name__ == "__main__":
main()
That's a great approach, thank you ❤️ P.S. Sorry for the late reply 😅