python-pptx
python-pptx copied to clipboard
save picture as SVG
could you add some save_as option for Picture class or Image class? Thanks!
The Image class does not support svg format.
Immutable value object representing an image such as a JPEG, PNG, or GIF.
But you can save it in a different format.
from pptx import Presentation
from PIL import Image as PIL_Image
from pptx.compat import BytesIO
shape = Presentation('file').slides[0].shapes[0]
stream = BytesIO(shape.image.blob)
pil_image = PIL_Image.open(stream)
pil_image.save('file_path', bitmap_format='png')