Convert Image to JPG in PHP

Load an image and save it in JPEG format with Aspose.Slides for PHP via Java.

Convert Image to JPG in PHP

Aspose.Slides for PHP via Java can load an image file and save it in JPEG format, keeping the image’s width and height.

The image API uses Images::fromFile to load the source image, save to write it, and ImageFormat::Jpeg to select JPEG output.

Convert Image to JPG using PHP

To convert an image to JPG, load it with Images::fromFile, save it with ImageFormat::Jpeg, and dispose of it when you are done.

PHP code for converting Image into JPG

$image = Images::fromFile("input.png");
try {
    $image->save("output.jpg", ImageFormat::Jpeg);
} finally {
    $image->dispose();
}

How to convert Image to JPG using Aspose.Slides for PHP API

These are the steps to convert Image to JPG in PHP.

  1. Install Aspose.Slides for PHP via Java .

  2. Configure Aspose.Slides in your PHP project.

  3. Load the source image with Images::fromFile.

  4. Save the image with save and ImageFormat::Jpeg, then call dispose to release it.

Free Online Converter

Try our free Conversion app

Convert Image To Other Supported Formats

You can also convert Image and save to other file formats. See all supported formats below: