Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions examples/src/charts/chart_marker_options_on_data_point.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aspose.slides as slides
import aspose.pydrawing as drawing


def charts_marker_options_on_data_point(global_opts):
Expand All @@ -22,11 +21,11 @@ def charts_marker_options_on_data_point(global_opts):
chart.chart_data.series.add(fact.get_cell(default_worksheet_index, 1, 1, "Series 1"), chart.type)

# Set the picture
img = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
img = slides.Images.from_file(global_opts.data_dir + "image1.jpg")
imgx1 = pres.images.add_image(img)

# Set the picture
img2 = drawing.Bitmap(global_opts.data_dir + "image2.jpg")
img2 = slides.Images.from_file(global_opts.data_dir + "image2.jpg")
imgx2 = pres.images.add_image(img2)

# Take first chart series
Expand Down
5 changes: 2 additions & 3 deletions examples/src/charts/get_chart_image.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import aspose.slides as slides
import aspose.pydrawing as drawing


def charts_get_chart_image(global_opts):
with slides.Presentation() as pres:
chart = pres.slides[0].shapes.add_chart(slides.charts.ChartType.CLUSTERED_COLUMN, 50, 50, 600, 400)
img = chart.get_thumbnail()
img.save(global_opts.out_dir + "charts_get_chart_image_out.png", drawing.imaging.ImageFormat.png)
img = chart.get_image()
img.save(global_opts.out_dir + "charts_get_chart_image_out.png", slides.ImageFormat.PNG)
7 changes: 3 additions & 4 deletions examples/src/charts/set_marker_options.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aspose.pydrawing as drawing
import aspose.slides as slides
import aspose.slides as slides


def charts_set_marker_options(global_opts):
Expand All @@ -23,11 +22,11 @@ def charts_set_marker_options(global_opts):
chart.chart_data.series.add(fact.get_cell(default_worksheet_index, 1, 1, "Series 1"), chart.type)

# Set the picture
image1 = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
image1 = slides.Images.from_file(global_opts.data_dir + "image1.jpg")
imgx1 = presentation.images.add_image(image1)

# Set the picture
image2 = drawing.Bitmap(global_opts.data_dir + "image2.jpg")
image2 = slides.Images.from_file(global_opts.data_dir + "image2.jpg")
imgx2 = presentation.images.add_image(image2)

# Take first chart series
Expand Down
2 changes: 0 additions & 2 deletions examples/src/rendering_printing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .render_comments import rendering_comments
from .render_options import rendering_options
from .rendering_3d import rendering_3d
from .rendering_emoji import rendering_emoji
Expand All @@ -7,7 +6,6 @@


def run_rendering_printing_examples(global_opts):
rendering_comments(global_opts)
rendering_options(global_opts)
rendering_3d(global_opts)
rendering_emoji(global_opts)
Expand Down
18 changes: 0 additions & 18 deletions examples/src/rendering_printing/render_comments.py

This file was deleted.

13 changes: 6 additions & 7 deletions examples/src/rendering_printing/render_options.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import aspose.slides as slides
import aspose.pydrawing as drawing


def rendering_options(global_opts):
with slides.Presentation(global_opts.data_dir + "rendering_options.pptx") as pres:
rendering_opts = slides.export.RenderingOptions()
rendering_opts.notes_comments_layouting.notes_position = slides.export.NotesPositions.BOTTOM_TRUNCATED

pres.slides[0].get_thumbnail(rendering_opts, 4 / 3, 4 / 3).save(
global_opts.out_dir + "rendering_options-Original.png", drawing.imaging.ImageFormat.png)
pres.slides[0].get_image(rendering_opts, 4 / 3, 4 / 3).save(
global_opts.out_dir + "rendering_options-Original.png", slides.ImageFormat.PNG)

rendering_opts.notes_comments_layouting.notes_position = slides.export.NotesPositions.NONE
rendering_opts.default_regular_font = "Arial Black"
pres.slides[0].get_thumbnail(rendering_opts, 4 / 3, 4 / 3).save(
global_opts.out_dir + "rendering_options-ArialBlackDefault.png", drawing.imaging.ImageFormat.png)
pres.slides[0].get_image(rendering_opts, 4 / 3, 4 / 3).save(
global_opts.out_dir + "rendering_options-ArialBlackDefault.png", slides.ImageFormat.PNG)

rendering_opts.default_regular_font = "Arial Narrow"
pres.slides[0].get_thumbnail(rendering_opts, 4 / 3, 4 / 3).save(
global_opts.out_dir + "rendering_options-ArialNarrowDefault.png", drawing.imaging.ImageFormat.png)
pres.slides[0].get_image(rendering_opts, 4 / 3, 4 / 3).save(
global_opts.out_dir + "rendering_options-ArialNarrowDefault.png", slides.ImageFormat.PNG)
2 changes: 1 addition & 1 deletion examples/src/rendering_printing/rendering_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ def rendering_3d(global_opts):
shape.three_d_format.extrusion_height = 100
shape.three_d_format.extrusion_color.color = drawing.Color.blue

pres.slides[0].get_thumbnail(2, 2).save(global_opts.out_dir + "sample_3d.png")
pres.slides[0].get_image(2, 2).save(global_opts.out_dir + "sample_3d.png")
pres.save(global_opts.out_dir + "rendering_3d_out.pptx", slides.export.SaveFormat.PPTX)
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import aspose.pydrawing as drawing
import aspose.slides as slides
import aspose.slides as slides


def add_relative_scale_height_picture_frame(global_opts):
# Instantiate presentation object
with slides.Presentation() as presentation:
# Load Image to be added in presentation image collection
img = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
img = slides.Images.from_file(global_opts.data_dir + "image1.jpg")
image = presentation.images.add_image(img)

# Add picture frame to slide
Expand Down
3 changes: 1 addition & 2 deletions examples/src/shapes/add_stretch_offset_for_image_fill.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import aspose.pydrawing as drawing
import aspose.slides as slides


Expand All @@ -9,7 +8,7 @@ def add_stretch_offset_for_image_fill(global_opts):
slide = pres.slides[0]

# Instantiate the Image class
img = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
img = slides.Images.from_file(global_opts.data_dir + "image1.jpg")
imgx = pres.images.add_image(img)

# Add Picture Frame with height and width equivalent of Picture
Expand Down
7 changes: 3 additions & 4 deletions examples/src/shapes/create_bounds_shape_thumbnail.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import aspose.pydrawing as drawing
import aspose.slides as slides
import aspose.slides as slides


def create_bounds_shape_thumbnail(global_opts):
# Instantiate a Presentation class that represents the presentation file
with slides.Presentation(global_opts.data_dir + "welcome-to-powerpoint.pptx") as presentation:
# Create a Appearance bound shape image
with presentation.slides[0].shapes[0].get_thumbnail(slides.ShapeThumbnailBounds.APPEARANCE, 1, 1) as bitmap:
with presentation.slides[0].shapes[0].get_image(slides.ShapeThumbnailBounds.APPEARANCE, 1, 1) as image:
# Save the image to disk in PNG format
bitmap.save(global_opts.out_dir + "shapes_get_thumbnail_bound_shape_out.png", drawing.imaging.ImageFormat.png)
image.save(global_opts.out_dir + "shapes_get_image_bound_shape_out.png", slides.ImageFormat.PNG)
11 changes: 5 additions & 6 deletions examples/src/shapes/create_scaling_factor_thumbnail.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import aspose.pydrawing as drawing
import aspose.slides as slides
import aspose.slides as slides


def create_scaling_factor_thumbnail(global_opts):
# Instantiate a Presentation class that represents the presentation file
with slides.Presentation(global_opts.data_dir + "welcome-to-powerpoint.pptx") as p:
with slides.Presentation(global_opts.data_dir + "welcome-to-powerpoint.pptx") as pres:
# Create a full scale image
with p.slides[0].shapes[0].get_thumbnail(slides.ShapeThumbnailBounds.SHAPE, 2, 2) as bitmap:
with pres.slides[0].shapes[0].get_image(slides.ShapeThumbnailBounds.SHAPE, 2, 2) as image:
# Save the image to disk in PNG format
bitmap.save(global_opts.out_dir + "shapes_create_scaling_thumbnail_out.png",
drawing.imaging.ImageFormat.png)
image.save(global_opts.out_dir + "shapes_create_scaling_thumbnail_out.png",
slides.ImageFormat.PNG)
7 changes: 3 additions & 4 deletions examples/src/shapes/create_shape_thumbnail.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import aspose.pydrawing as drawing
import aspose.slides as slides
import aspose.slides as slides


def create_shape_thumbnail(global_opts):
# Instantiate a Presentation class that represents the presentation file
with slides.Presentation(global_opts.data_dir + "welcome-to-powerpoint.pptx") as presentation:
# Create a full scale image
with presentation.slides[0].shapes[0].get_thumbnail() as bitmap:
with presentation.slides[0].shapes[0].get_image() as image:
# Save the image to disk in PNG format
bitmap.save(global_opts.out_dir + "shapes_get_shape_thumbnail_out.png", drawing.imaging.ImageFormat.png)
image.save(global_opts.out_dir + "shapes_get_shape_thumbnail_out.png", slides.ImageFormat.PNG)
7 changes: 3 additions & 4 deletions examples/src/shapes/create_smart_art_child_note_thumbnail.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aspose.pydrawing as drawing
import aspose.slides as slides
import aspose.slides as slides


def create_smart_art_child_note_thumbnail(global_opts):
Expand All @@ -12,7 +11,7 @@ def create_smart_art_child_note_thumbnail(global_opts):
node = smart.nodes[1]

# Get thumbnail
bmp = node.shapes[0].get_thumbnail()
image = node.shapes[0].get_image()

# Save thumbnail
bmp.save(global_opts.out_dir + "shapes_create_smartart_thumbnail_out.jpeg", drawing.imaging.ImageFormat.jpeg)
image.save(global_opts.out_dir + "shapes_create_smartart_thumbnail_out.jpeg", slides.ImageFormat.JPEG)
3 changes: 1 addition & 2 deletions examples/src/shapes/fill_shapes_picture.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aspose.slides as slides
import aspose.pydrawing as drawing


def fill_shapes_picture(global_opts):
Expand All @@ -18,7 +17,7 @@ def fill_shapes_picture(global_opts):
shape.fill_format.picture_fill_format.picture_fill_mode = slides.PictureFillMode.TILE

# Set the picture
img = drawing.Bitmap(global_opts.data_dir + "image2.jpg")
img = slides.Images.from_file(global_opts.data_dir + "image2.jpg")
imgx = pres.images.add_image(img)
shape.fill_format.picture_fill_format.picture.image = imgx

Expand Down
2 changes: 1 addition & 1 deletion examples/src/shapes/picture_frame_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def picture_frame_formatting(global_opts):
slide = pres.slides[0]

# Instantiate the Image class
img = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
img = slides.Images.from_file(global_opts.data_dir + "image1.jpg")
imgx = pres.images.add_image(img)

# Add Picture Frame with height and width equivalent of Picture
Expand Down
5 changes: 2 additions & 3 deletions examples/src/shapes/sketched_shapes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aspose.slides as slides
import aspose.pydrawing as drawing


def sketched_shapes(global_opts):
Expand All @@ -14,6 +13,6 @@ def sketched_shapes(global_opts):
# Transform shape to sketch of a freehand style
shape.line_format.sketch_format.sketch_type = slides.LineSketchType.SCRIBBLE

pres.slides[0].get_thumbnail(4 / 3, 4 / 3).save(global_opts.out_dir + "shapes_sketch_format_out.png",
drawing.imaging.ImageFormat.png)
pres.slides[0].get_image(4 / 3, 4 / 3).save(global_opts.out_dir + "shapes_sketch_format_out.png",
slides.ImageFormat.PNG)
pres.save(global_opts.out_dir + "shapes_sketch_format_out.pptx", slides.export.SaveFormat.PPTX)
5 changes: 2 additions & 3 deletions examples/src/shapes/stretch_offset_left_for_picture_frame.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aspose.pydrawing as drawing
import aspose.slides as slides
import aspose.slides as slides


def stretch_offset_left_for_picture_frame(global_opts):
Expand All @@ -9,7 +8,7 @@ def stretch_offset_left_for_picture_frame(global_opts):
slide = pres.slides[0]

# Instantiate the Image class
img = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
img = slides.Images.from_file(global_opts.data_dir + "image1.jpg")
imgx = pres.images.add_image(img)

# Add an AutoShape of Rectangle type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aspose.slides as slides
import aspose.pydrawing as drawing


def substitute_picture_title_of_ole_object_frame(global_opts):
Expand All @@ -16,8 +15,9 @@ def substitute_picture_title_of_ole_object_frame(global_opts):
oof.is_object_icon = True

# Add image object
image = pres.images.add_image(drawing.Bitmap(global_opts.data_dir + "image1.jpg"))
oof.substitute_picture_format.picture.image = image
img = slides.Images.from_file(global_opts.data_dir + "image1.jpg")
imgx = pres.images.add_image(img)
oof.substitute_picture_format.picture.image = imgx

# Set caption to OLE icon
oof.substitute_picture_title = "Caption example"
3 changes: 1 addition & 2 deletions examples/src/slides/background/set_image_as_background.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import aspose.pydrawing as drawing
import aspose.slides as slides


Expand All @@ -11,7 +10,7 @@ def set_image_as_background(global_opts):
pres.slides[0].background.fill_format.picture_fill_format.picture_fill_mode = slides.PictureFillMode.STRETCH

# Set the picture
img = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
img = slides.Images.from_file(global_opts.data_dir + "image1.jpg")

# Add image to presentation's images collection
imgx = pres.images.add_image(img)
Expand Down
5 changes: 2 additions & 3 deletions examples/src/slides/thumbnail/thumbnail_from_slide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import aspose.pydrawing as drawing
import aspose.slides as slides


Expand All @@ -9,7 +8,7 @@ def thumbnail_from_slide(global_opts):
slide = pres.slides[0]

# Create a full scale image
bmp = slide.get_thumbnail(1, 1)
bmp = slide.get_image(1, 1)

# Save the image to disk in JPEG format
bmp.save(global_opts.out_dir + "thumbnail_from_slide_out.jpg", drawing.imaging.ImageFormat.jpeg)
bmp.save(global_opts.out_dir + "thumbnail_from_slide_out.jpg", slides.ImageFormat.JPEG)
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import aspose.pydrawing as drawing
import aspose.slides as slides


Expand All @@ -17,6 +16,6 @@ def thumbnail_from_slide_in_notes(global_opts):
scale_y = (1.0 / pres.slide_size.size.height) * desired_y

# Create a full scale image
bmp = slide.get_thumbnail(scale_x, scale_y)
bmp = slide.get_image(scale_x, scale_y)
# Save the image to disk in JPEG format
bmp.save(global_opts.out_dir + "thumbnail_get_from_notes_out.jpg", drawing.imaging.ImageFormat.jpeg)
bmp.save(global_opts.out_dir + "thumbnail_get_from_notes_out.jpg", slides.ImageFormat.JPEG)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def thumbnail_with_user_defined_dimensions(global_opts):
scale_y = (1.0 / pres.slide_size.size.height) * desired_y

# Create a full scale image
bmp = slide.get_thumbnail(scale_x, scale_y)
bmp = slide.get_image(scale_x, scale_y)

# Save the image to disk in JPEG format
bmp.save(global_opts.out_dir + "thumbnail_user_defined_dimensions_out.jpg", drawing.imaging.ImageFormat.jpeg)
bmp.save(global_opts.out_dir + "thumbnail_user_defined_dimensions_out.jpg", slides.ImageFormat.JPEG)
8 changes: 4 additions & 4 deletions examples/src/smart_arts/bullet_fill_format_example.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import aspose.slides as slides
import aspose.pydrawing as drawing


def bullet_fill_format_example(global_opts):
with slides.Presentation() as presentation:
smart = presentation.slides[0].shapes.add_smart_art(10, 10, 500, 400, slides.smartart.SmartArtLayoutType.VERTICAL_PICTURE_LIST)
smart = presentation.slides[0].shapes.add_smart_art(10, 10, 500, 400,
slides.smartart.SmartArtLayoutType.VERTICAL_PICTURE_LIST)
node = smart.all_nodes[0]

if node.bullet_fill_format is not None:
img = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
img = slides.Images.from_file(global_opts.data_dir + "image1.jpg")
image = presentation.images.add_image(img)
node.bullet_fill_format.fill_type = slides.FillType.PICTURE
node.bullet_fill_format.picture_fill_format.picture.image = image
node.bullet_fill_format.picture_fill_format.picture_fill_mode = slides.PictureFillMode.STRETCH

presentation.save(global_opts.out_dir +"smart_art_bullet_fill_format_out.pptx", slides.export.SaveFormat.PPTX)
presentation.save(global_opts.out_dir + "smart_art_bullet_fill_format_out.pptx", slides.export.SaveFormat.PPTX)
2 changes: 1 addition & 1 deletion examples/src/tables/add_image_inside_table_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def add_image_inside_table_cell(global_opts):
tbl = slide.shapes.add_table(50, 50, dbl_cols, dbl_rows)

# Creating a Image object to hold the image file
image = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
image = slides.Images.from_file(global_opts.data_dir + "image1.jpg")

# Create an object using the bitmap object
imgx1 = presentation.images.add_image(image)
Expand Down
5 changes: 2 additions & 3 deletions examples/src/tables/add_image_inside_table_cell_and_crop.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aspose.pydrawing as drawing
import aspose.slides as slides
import aspose.slides as slides


def add_image_inside_table_cell_and_crop(global_opts):
Expand All @@ -16,7 +15,7 @@ def add_image_inside_table_cell_and_crop(global_opts):
tbl = slide.shapes.add_table(50, 50, dbl_cols, dbl_rows)

# Creating a Image object to hold the image file
image = drawing.Bitmap(global_opts.data_dir + "image1.jpg")
image = slides.Images.from_file(global_opts.data_dir + "image1.jpg")

# Create an object using the bitmap object
imgx1 = presentation.images.add_image(image)
Expand Down
Loading