Convert TIFF to JPEG in C++

Use C++ to place a TIFF image on a slide and export it to JPEG without Microsoft PowerPoint.

Convert TIFF to JPEG Using C++

Aspose.Slides for C++ is a PowerPoint processing API that lets you place TIFF images on slides and export them to JPEG in C++ applications without Microsoft PowerPoint. Install the package from NuGet or use the following Package Manager Console command.

Command

PM> Install-Package Aspose.Slides.Cpp

TIFF to JPEG C++ Conversion Source Code

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

auto imageData = File::ReadAllBytes(u"image.tiff");
auto presentationImage = presentation->get_Images()->AddImage(imageData);
slide->get_Shapes()->AddPictureFrame(
    ShapeType::Rectangle,
    0,
    0,
    slideSize.get_Width(),
    slideSize.get_Height(),
    presentationImage);

auto image = slide->GetImage(2.0, 2.0);
image->Save(u"image.jpeg", ImageFormat::Jpeg);
image->Dispose();

presentation->Dispose();

How to Convert TIFF to JPEG via C++

C++ developers can convert a TIFF file to JPEG by creating a presentation, adding the TIFF image to a slide, and then using Aspose.Slides for C++ to render the slide as a JPEG image.

  1. Create a Presentation instance.
  2. Read the TIFF file bytes with File::ReadAllBytes.
  3. Add the TIFF image to the first slide with AddPictureFrame.
  4. Call GetImage with the required output size.
  5. Save the image with the required ImageFormat value.

System Requirements

Before running the C++ conversion example, make sure that the following prerequisites are available.

  • Microsoft Windows, Linux, or another compatible OS with the supported C++ runtime.
  • Aspose.Slides for C++ referenced in your project.

Built with Aspose.Slides

Convert TIFF to JPEG Online

The free Aspose.Slides Conversion app is built with Aspose.Slides for C++, the same API as the code above. Open it and see what the API can do with your own TIFF files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides converts files before you write code.
  • Upload TIFF files and save them as JPEG.
  • Download the result or convert more files.