Categories: Development

PHP Imagick JPG compression quality 1 to 100

Comparing Imagick a PHP image plugin JPG image file compression from 1 (lowest) through to 100.

The original image was 1MB and the code used to do this test was:

readImage("ogimage.jpg");
    $im->setImageCompression(Imagick::COMPRESSION_JPEG);
    $im->setImageCompressionQuality($i);
    $im->setImageFormat("jpg");
    $im->stripImage();
    $im->writeImage("output/$i.jpg");
    $im->destroy();
    echo "$i is done
"; }

The compressed file sizes:

Imagick php jpg compression quality size

 

Quality 64 is actually when the file size starts to drop, whilst 77 through to 100 add-on size. Quality 1 through to 20 has discoloration and obvious pixels.

The original image:

Quality 64

Imagick php jpg quality 64

Quality 50

Imagick php jpg quality 50

Quality 30

Imagick php jpg quality 30

Quality 20

Imagick php jpg quality 20

Quality 1

Imagick php jpg quality 1

 

 

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago