• Call Us: +92-333-7276335
  • - Mail Us: info@shekztech.com

Plot 1177, Sector 31B - Crossing, Karachi, Sindh

Loading...
Integrating the pngquant Command-line Utility for Optimal PNG Compression
  • Views: 382
  • Category: WHM
  • Published at: 17 Aug, 2023
  • Updated at: 18 Aug, 2023

Integrating the pngquant Command-line Utility for Optimal PNG Compression

The Intervention library stands as a powerhouse in PHP for image management, leveraging the capabilities of both the GD Library and Imagick. While its prowess is undeniable, it falls short with .png images. For instance, a PNG image reduction from 1.3 MB may only reach 1.1 or 1.2 MB, which, considering website optimization and SEO implications, might not be the best outcome. The strength of Intervention is predominantly evident when converting images, especially from .png and jpg to webp format – achieving size reductions as impressive as from 1381.50 KB down to 46.75 KB.

For better handling of lossy PNG compression, the pngquant command-line utility emerges as a top contender. If you’re aiming to harness this utility, you first need to ascertain its availability in your environment. Should you be operating on a VPS, pngquant's integration is straightforward. By inputting pngquant --version into your terminal, an output resembling 2.12.5 (July 2019) should appear. Note: Direct terminal or SSH access is crucial for this step. If on shared hosting, reaching out to your hosting service becomes necessary.

To employ the pngquant library, execute the following:

pngquant --force --output=outputImage.png inputImage.png

Enabling the EPEL Repository:

pngquant is housed in the EPEL repository. Activating this repository is the first step:

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

pngquant Installation:

Post EPEL setup, pngquant can be installed with:

sudo dnf install pngquant

Installation Verification:

To ensure a successful pngquant installation, input:

pngquant --version

Once the library is installed, verify if exec is enabled in your environment using:

php -I | grep disable_functions

For those with root or WHM permissions, adjustments to the disable_functions can be made by navigating to MultiPHP Manager, selecting "Edit PHP-FPM", pinpointing the desired section, excluding it from the "Disable Functions" area, and finalizing with an update.

Integrating the pngquant Command-line Utility for Optimal PNG Compression

This guide aids in smoothly integrating pngquant and ensuring a robust setup for optimal PNG compression.

Shehzad Ahmed

Shehzad Ahmed is a highly qualified expert with a Master of Philosophy in Computer Science and a decade of extensive industry experience. With his impressive track record in web development and computer science, he has not only left an indelible mark on the industry but also made substantial contributions to education. Since , he has created more than eighty exhaustive courses, paving the way for innumerable individuals interested in learning and development. His unparalleled knowledge and innate ability to elucidate complex ideas make him a highly sought-after educator and consultant. Choose Shehzad and take advantage of his exceptional balance of technical expertise and teaching prowess to propel your learning journey or project to new heights.

0 Comment(s)
Write your comment