Convert JPG to Image in C++

Convert JPG files to images using Aspose.Slides for C++ without Microsoft PowerPoint.

Convert JPG to Image in C++

Aspose.Slides for C++ is a presentation processing API that can import JPG files into slides and render the result as image files.

Aspose.Slides for C++ can convert JPG content to images and other presentation-related formats.

Convert JPG to Image Using C++

To convert JPG to an image, create a Presentation from the JPG file and render each slide as an image.

C++ code for converting JPG into Image

auto presentation = MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);

auto imageData = File::ReadAllBytes(u"image.jpg");
auto presentationImage = presentation->get_Images()->AddImage(imageData);
slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 10, 10, 100, 100, presentationImage);

// Convert the slide to an image.
auto slideImage = slide->GetImage(2.0f, 2.0f);

// Save the image in PNG format.
slideImage->Save(u"slide.png", ImageFormat::Png);
slideImage->Dispose();

presentation->Dispose();

How to Convert JPG to Image Using Aspose.Slides for C++ API

These are the steps to convert JPG to Image in C++.

  1. Install Aspose.Slides for C++ .

  2. Add a library reference (import the library) to your C++ project.

  3. Open the source JPG file in C++.

  4. Save the result as an image file.

Free Online Converter

Convert presentations and slides online.

Convert JPG to Other Supported Formats

You can also convert JPG files and save them to other file formats. See all supported formats below.