Resize image files

Welcome to the Resize image guide. This guide will teach you how to Resize one or more image files easily.

You can resize using a percent value or a explicit pixel size based

Resize percent

Resize can be set using the percent mode, and then set a percent value.

Download the PHP library from GitHub

Resize by pixels

If you need more control about a specific size, you can change the mode to 'pixel' and define width and/or height values.

Download the PHP library from GitHub

The 'pixels' mode is composed by 2 different functions setPixelsWidth(number) and setPixelsHeight(number). If you set both functions, the image will be resized to fit inside the width and height values. If only width is set, image will be resized to new width and height will be set proporionally. The same for height.

It is also possible to allow images being bigger than their originals by setting setNoEnlargeIfSmaller(boolean). And enable or disable image stretch or distort with the function setMaintainRatio(boolean).

Remember that you can explore more functions like setting the output filename in the Common features guide.