I’m trying to use io to convert an image from .bmp to .gif. My python code is below. Further below is the error.
import cv2
import io
from io import BytesIO
with open(“output.bmp”, “rb”) as img:
imageToFilter = img.read()
with BytesIO() as image:
imageToFilter.save(image, format = “GIF”)
image.seek(0)
my_gif = Image.open(image)
myImage2 = smoothImage(my_gif)
cv2.imwrite(“output1.bmp”, myImage2)
Traceback (most recent call last):
File “test.py”, line 15, in
imageToFilter.save(image, format = “GIF”)
AttributeError: ‘bytes’ object has no attribute ‘save’