Merge JPG in Python

High-speed and cross-platform Python library for merging JPG images using Python code

Merge JPG to JPG using Aspose.Slides

Aspose.Slides for Python via .NET is a powerful Python library used to merge and manipulate presentations, images, and other files. When you merge JPG to JPG, you are effectively combining two images to get one picture.

Merge JPG to JPG in Python

Using Aspose.Slides for Python via .NET , you can merge JPG files quickly with just a few lines of code

Python code for merging JPG to JPG


import aspose.slides as slides
import aspose.pydrawing as drawing

with slides.Presentation() as pres:
    slide = pres.slides[0]
    image1 = pres.images.add_image(drawing.Bitmap("image1.jpg"))
	slide.shapes.add_picture_frame(slides.ShapeType.RECTANGLE, 0, 0, 100, 100, image1)

    image2 = pres.images.add_image(drawing.Bitmap("image2.jpg"))
	slide.shapes.add_picture_frame(slides.ShapeType.RECTANGLE, 0, 200, 100, 100, image2)

    for sld in pres.slides:
        bmp = sld.get_thumbnail(1, 1)
        bmp.save("Slide_{num}.jpg".format(num=str(sld.slide_number)), drawing.imaging.ImageFormat.jpeg)

How to merge JPG in Python

  1. Install Aspose.Slides for Python via .NET. See Installation .

  2. Add the library as a reference in your project.

  3. Create an instance of the Presentation class.

  4. Load the JPG files you want to merge as picture frames.

  5. Save the resulting JPG image.

Merge other files

You can also combine files in other formats to get a single file