def create_thumbnail_in_notes_slides_view(dataDir): # Instantiate Presentation class that represents the presentation file pres = Presentation(dataDir + 'demo.pptx') # Access the first slide slide = pres.getSlides().get_Item(0) # User defined dimension desired_x = 1200 desired_y = 800 # Getting scaled value of X and Y scale_x = (1.0 / java_values( pres.getSlideSize().getSize().getWidth())) * desired_x scale_y = (1.0 / java_values( pres.getSlideSize().getSize().getHeight())) * desired_y # Create a full scale image image = slide.getNotesSlide().getThumbnail(scale_x, scale_y) # Save the image to disk in JPEG format imageIO = ImageIO() imageIO.write(image, "jpeg", File(dataDir + "ContentBG_tnail.jpg")) print "Created thumbnail in notes slides view, please check the output file.".PHP_EOL
def __init__(self): dataDir = Settings.dataDir + 'WorkingWithTables/AddImage/' pres = Presentation() # Get the first slide sld = pres.getSlides().get_Item(0) # Define co lumns with widths and rows with heights dbl_cols = [150,150,150,150] dbl_rows = [100,100,100,100,90] # Add table shape to slide tbl = sld.getShapes().addTable(50, 50, dbl_cols, dbl_rows) # Creating a Buffered Image object to hold the image file imageIO = ImageIO() image = imageIO.read(File(dataDir + "aspose-logo.jpg")) imgx1 = pres.getImages().addImage(image) fillType=FillType() pictureFillMode=PictureFillMode() tbl.get_Item(0,0).getFillFormat().setFillType(fillType.Picture) tbl.get_Item(0,0).getFillFormat().getPictureFillFormat().setPictureFillMode(pictureFillMode.Stretch) tbl.get_Item(0,0).getFillFormat().getPictureFillFormat().getPicture().setImage(imgx1) # Write the presentation as a PPTX file save_format = SaveFormat() pres.save(dataDir + "AddImage.pptx", save_format.Pptx) print "Added image, please check the output file."
def create_thumbnail_of_user_defined_window(dataDir): # Instantiate Presentation class that represents the presentation file pres = Presentation(dataDir + 'demo.pptx') # Access the first slide slide = pres.getSlides().get_Item(0) # Create a full scale image image = slide.getThumbnail(1, 1) # Getting the image of desired window inside generated slide thumnbnail # BufferedImage window = image.getSubimage(windowX, windowY, windowsWidth, windowHeight) window_image = image.getSubimage(100, 100, 200, 200) # Save the image to disk in JPEG format imageIO = ImageIO() imageIO.write(image, "jpeg", File(dataDir + "ContentBG_tnail.jpg")) print "Created thumbnail of user defined window, please check the output file.".PHP_EOL