php8.5
Home/ Manual/ reference / image/ Supported image formats

Supported image formats

If you have the GD library (available at Gd) you will also be able to create and manipulate images.

Setup

Required

If you have the GD library (available at Gd) you will also be able to create and manipulate images.

The format of images you are able to manipulate depend on the version of GD you install, and any other libraries GD might need to access those image formats.

Note

libgd-2.1.0 or higher is required. Alternatively, use the bundled GD library that ships with PHP.

Note

The GD library requires zlib >= 1.2.0.4.

You may wish to enhance GD to handle more image formats.

Image formatLibrary to downloadNotes
gif
avif
jpegJpegWhen building the jpeg library (prior to building PHP) you must use the --enable-shared option in the configure step. If you do not, you will receive an error saying libjpeg.(a|so) not found when you get to the configure step of building PHP.
pngLibpng
xpmLibxpmIt's likely you have this library already available, if your system has an installed X-Environment.
webp

You may wish to enhance GD to deal with different fonts. The FreeType 2 library is supported.

Configure Ini

Resources

This extension defines the following resource types:

NameDescriptionNotes
gdImage resource, used by functions like imagecreatefrompng()Prior to PHP 8.0.0
gd fontFont resource internally created by imageloadfont()Prior to PHP 8.1.0

Source: reference/image/setup.xml · from the official PHP manual (php/doc-en)