I\'ve stored image files as BLOBs in a mysql database via a python script using BytesIO:
with BytesIO() as f: rgb_img.save(f, format=\'JPEG\', optimize=Tru