Convert image files

Welcome to the Convert image guide. This guide will teach you how to convert one or more images easily.

Remember that all Tool Guides takes into account that you have previous knowledge about the Basics to process an image with our REST API. We strongly recommend you to read the related guide before start with this one.

Convert to JPG

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

Download the PHP library from GitHub

Image formats you can convert to JPG: PNG, GIF, TIF, PSD, SVG, WEBP or RAW

Raw formats that can be converted are CR2, RW2, NEF, ARW, SR2, ORF, PEF, RAF

If you convert an animated GIF to JPG, each animation frame will be converted to a distinct JPG image, so you will have multiple images as a result.

Convert JPG to PNG

JPG images can be converted to PNG or GIF

In order to convert to png you just need to set the setTo('png') function to 'png'.

Download the PHP library from GitHub

JPG to static GIF

A more complex conversion is a JPG to GIF creation where you can create static GIF files or a full animated GIF.

To create a static GIF the code is similar to PNG conversion, just set the setTo() method as shown:

Download the PHP library from GitHub

JPG to animated GIF

To create an animated GIF you can see the example code using all available properties:

Download the PHP library from GitHub

The method setGifTime() can define the animation speed by seconds per frame. Its param is calculated in hundredths of a second.

Finally, with the setGifLoop() you can control if animation stops at the end of the animation or if it loops forever.