PHP Classes

JPEG Reducer: Reduce a JPEG file size adjusting its quality

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 53%Total: 2,831 All time: 1,334 This week: 524Up
Version License PHP version Categories
jpegreducer 1.0.0Freeware3Graphics, Compression


To reduce the size of JPEG image file, usually the image is saved with lower quality compression factor.

However, using this method it is not guaranteed that the size of the resulting image file will be smaller than a given size limit.

JPEG Reducer is a class that solves this problem by trying different quality to determine the ideal compression ratio to reduce image to the target limit size just by specifying that limit value in class variable.

This class can be used in public photo gallery to make sure all images are have acceptable size.

Innovation Award
PHP Programming Innovation award winner
November 2004

Prize: One downloadable copy of Roadsend PHP Compiler
Sometimes it is necessary to limit the size occupied by the files of image archives to prevent that they take too much disk space.

The size of JPEG image files can be reduced by using a lower quality factor when saving to a file but it is not easy to determine what is the smallest quality factor reduction that guarantees that an image file will not exceed a given limit.

This class provides an approximate solution based on a few tests using different quality factors and then using interpolation to reach a reduction factor close to the ideal value that can be used to keep the file size near the limit.

Manuel Lemos
Picture of Huda M Elmatsani
Name: Huda M Elmatsani <contact>
Classes: 14 packages by
Country: Indonesia Indonesia
Age: ???
All time rank: 161 in Indonesia Indonesia
Week rank: 280 Down6 in Indonesia Indonesia Down
Innovation award
Innovation award
Nominee: 5x

Winner: 3x

  Files folder image Files  
File Role Description
Plain text file class.jpegreducer.php Class class reduce jpeg filesize
Plain text file class.jpegxreducer.php Class variant
Accessible without login Plain text file test.jpegreducer.php Example example
Accessible without login Plain text file test.jpegxreducer.php Example example: one line call

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:1,334
This week:524Up
 User Ratings  
 All time