Convert Images Guide

Create your own Image Converter to transform PNG, GIF, TIF, PSD, SVG, WEBP and RAW to JPG in seconds.

New to the API? Start with Processing an image: every tool guide builds on its task flow.

Convert to JPG

By default all images will be converted to JPG, simply use this code sample to convert your images to JPG:

Start taskPHP
// Create a new task
$myTaskConvert = $iloveimg->newTask('convert');

// Add files to task for upload
$file1 = $myTaskConvert->addFile('path/to/file1_name.tiff');
$file2 = $myTaskConvert->addFile('path/to/file2_name.png');

// Execute the task
$myTaskConvert->execute();

// Download the package files
$myTaskConvert->download();
PHP library ilovepdf/iloveimg-phpcomposer require ilovepdf/iloveimg-php

Convert JPG to PNG

In order to convert to PNG you just need to set the property to to png.

Start taskPHP
// Create a new task
$myTaskConvert = $iloveimg->newTask('convert');

// Add files to task for upload
$file1 = $myTaskConvert->addFile('path/to/file1_name.jpg');

$myTaskConvert->setTo('png');

// Execute the task
$myTaskConvert->execute();

// Download the package files
$myTaskConvert->download();
PHP library ilovepdf/iloveimg-phpcomposer require ilovepdf/iloveimg-php

Convert JPG to static GIF

In order to convert to a static GIF you just need to set the property to to gif.

Start taskPHP
// Create a new task
$myTaskConvert = $iloveimg->newTask('convert');

// Add files to task for upload
$file1 = $myTaskConvert->addFile('path/to/file1_name.jpg');

$myTaskConvert->setTo('gif');

// Execute the task
$myTaskConvert->execute();

// Download the package files
$myTaskConvert->download();
PHP library ilovepdf/iloveimg-phpcomposer require ilovepdf/iloveimg-php

Convert JPG to animated GIF

In order to join all the images of the task into a single animated GIF you just need to set the property to to gif_animation.

Start taskPHP
// Create a new task
$myTaskConvert = $iloveimg->newTask('convert');

// Add files to task for upload
$file1 = $myTaskConvert->addFile('path/to/file1_name.jpg');
$file2 = $myTaskConvert->addFile('path/to/file2_name.jpg');

$myTaskConvert->setTo('gif_animation');
$myTaskConvert->setGifTime(50);
$myTaskConvert->setGifLoop(true);

// Execute the task
$myTaskConvert->execute();

// Download the package files
$myTaskConvert->download();
PHP library ilovepdf/iloveimg-phpcomposer require ilovepdf/iloveimg-php

With this option you can also configure the time each image is shown (in hundredths of a second, default 50) and whether the animation loops (default true) with the properties gif_time and gif_loop.