pip install Wand
from wand.image import Image
with Image(filename='pikachu.png') as original:
with original.convert('jpeg') as converted:
# operations to a jpeg image...
pass
import magic
, а дальше уже делать то вы планируете делать...