当前位置: 首页>>代码示例>>Python>>正文


Python Presentation.getImages方法代码示例

本文整理汇总了Python中com.aspose.slides.Presentation.getImages方法的典型用法代码示例。如果您正苦于以下问题:Python Presentation.getImages方法的具体用法?Python Presentation.getImages怎么用?Python Presentation.getImages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.aspose.slides.Presentation的用法示例。


在下文中一共展示了Presentation.getImages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getImages [as 别名]
    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."
开发者ID:Aspose,项目名称:Aspose.Slides-for-Java,代码行数:34,代码来源:AddImage.py

示例2: set_image_as_background_color

# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getImages [as 别名]
    def set_image_as_background_color(dataDir):
        
        dataDir = Settings.dataDir + 'WorkingWithSlidesInPresentation/Background/'
        
        # Instantiate Presentation class that represents the presentation file
        pres = Presentation()

        # Set the background with Image

        backgroundType = BackgroundType
        fillType = FillType
        pictureFillMode = PictureFillMode

        pres.getSlides().get_Item(0).getBackground().setType(backgroundType.OwnBackground)
        pres.getSlides().get_Item(0).getBackground().getFillFormat().setFillType(fillType.Picture)
        pres.getSlides().get_Item(0).getBackground().getFillFormat().getPictureFillFormat().setPictureFillMode(pictureFillMode.Stretch)

        # Set the picture
        imgx = pres.getImages().addImage(FileInputStream(File(dataDir + 'night.jpg')))

        # Image imgx = pres.getImages().addImage(image)
        # Add image to presentation's images collection

        pres.getSlides().get_Item(0).getBackground().getFillFormat().getPictureFillFormat().getPicture().setImage(imgx)

        # Saving the presentation
        save_format = SaveFormat
        pres.save(dataDir + "ContentBG_Image.pptx", save_format.Pptx)

        print "Set image as background, please check the output file."
开发者ID:HareshV,项目名称:Aspose.Slides-for-Java,代码行数:32,代码来源:Background.py

示例3: fill_shapes_with_picture

# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getImages [as 别名]
    def fill_shapes_with_picture(dataDir):
        
        dataDir = Settings.dataDir + 'WorkingWithShapes/FillingShapes/'
        
        # Create an instance of Presentation class
        pres = Presentation()

        # Get the first slide
        sld = pres.getSlides().get_Item(0)

        # Add autoshape of rectangle type
        shapeType = ShapeType
        shp = sld.getShapes().addAutoShape(shapeType.Rectangle, 50, 150, 75, 150)

        # Set the fill type to Picture
        fillType = FillType
        shp.getFillFormat().setFillType(fillType.Picture)

        # Set the picture fill mode
        pictureFillMode = PictureFillMode
        shp.getFillFormat().getPictureFillFormat().setPictureFillMode(pictureFillMode.Tile)

        # Set the picture
        imgx = pres.getImages().addImage(FileInputStream(File(dataDir + "night.jpg")))

        shp.getFillFormat().getPictureFillFormat().getPicture().setImage(imgx)

        # Write the presentation as a PPTX file
        save_format = SaveFormat
        pres.save(dataDir + "RectShpPic.pptx", save_format.Pptx)

        print "Filled shapes with Picture, please check the output file."
开发者ID:Aspose,项目名称:Aspose.Slides-for-Java,代码行数:34,代码来源:FillingShapes.py

示例4: add_picture_frame

# 需要导入模块: from com.aspose.slides import Presentation [as 别名]
# 或者: from com.aspose.slides.Presentation import getImages [as 别名]
    def add_picture_frame(dataDir):
        
        dataDir = Settings.dataDir + 'WorkingWithShapes/Frame/'
        
         # Create an instance of Presentation class
        pres = Presentation()

        # Get the first slide
        sId = pres.getSlides().get_Item(0)

        # Instantiate the Image class
        imgx = pres.getImages().addImage(FileInputStream(File(dataDir + "aspose-logo.jpg")))

        # Add Picture Frame with height and width equivalent of Picture
        shapeType = ShapeType
        sId.getShapes().addPictureFrame(shapeType.Rectangle, 50, 150, imgx.getWidth(), imgx.getHeight(), imgx)

        # Write the presentation as a PPTX file
        save_format = SaveFormat
        pres.save(dataDir + "RectPicFrame.pptx", save_format.Pptx)

        print "Added picture frame to slide, please check the output file."
开发者ID:Aspose,项目名称:Aspose.Slides-for-Java,代码行数:24,代码来源:Frame.py


注:本文中的com.aspose.slides.Presentation.getImages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。