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.
Install Aspose.Slides for PHP via Java .
Configure Aspose.Slides in your PHP project.
Load the source image with
Images::fromFile.Save the image with
saveandImageFormat::Jpeg, then calldisposeto release it.
Free Online Converter
Convert Image To Other Supported Formats
You can also convert Image and save to other file formats. See all supported formats below: