I'm trying to get the image from clipboard and I want to add that image in python-pptx . I don't want to save the image in the Disk. I have tried this:
from pptx import Presentation
from PIL import ImageGrab,Image
from pptx.util import Inches
im = ImageGrab.grabclipboard()
prs = Presentation()
title_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_slide_layout)
left = top = Inches(1)
pic = slide.shapes.add_picture(im, left, top)
prs.save('PPT.pptx')
But Getting this error
File "C:\Python27\lib\site-packages\PIL\Image.py", line 627, in __getattr__
raise AttributeError(name)
AttributeError: read
What is wrong with this?
pic = slide.shapes.add_picture(output, left, top)
– Stonehenge