DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
VGSources
Blog

How to Install Image Optimization Packages for WordPress on Ubuntu

A practical Ubuntu guide to installing WordPress image-optimization binaries, enabling Imagick, adding WebP and AVIF support, configuring SVGO, and troubleshooting runtime and path problems.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install the server-side tools with APT, add SVGO through npm, enable the Imagick extension in the same PHP runtime that serves WordPress, and then point your image-optimization plugin or script at the verified executables. The baseline Ubuntu command is:

sudo apt update
sudo apt install imagemagick jpegoptim optipng pngquant gifsicle webp libavif-bin

That installs ImageMagick plus JPEG, PNG, GIF, WebP, and AVIF utilities. SVG optimization is a separate npm installation. WordPress will not automatically call every binary merely because it is present, so verification and plugin configuration are essential.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the packages do

WordPress image processing depends on two layers: a PHP image editor, commonly Imagick, and command-line encoders or optimizers. ImageMagick supplies general image conversion; the format-specific utilities give an optimizer more control over compression and output formats.

Package or component What it provides Typical WordPress use
imagemagick ImageMagick command-line tools, exposed as magick on newer layouts or convert on older ImageMagick 6 layouts General conversion, resizing, metadata handling, and the backend used by Imagick
jpegoptim JPEG optimization Photographs and other JPEG uploads
optipng Lossless PNG optimization PNG graphics where pixel data must remain unchanged
pngquant Palette-based PNG compression Smaller PNGs when some color reduction is acceptable
gifsicle GIF optimization GIF compression and animation handling
webp The cwebp encoder and related WebP tools Generating WebP derivatives
libavif-bin The avifenc AVIF encoder Generating AVIF derivatives
SVGO Node-based SVG optimizer installed globally with npm Removing unnecessary SVG data and simplifying vectors
PHP Imagick extension PHP bindings to ImageMagick Allows WordPress and plugins to use ImageMagick from PHP
Ghostscript PDF rendering support for ImageMagick Needed only when the site must create thumbnails from PDFs

Ubuntu’s package index lists ImageMagick for supported releases including Ubuntu 22.04 LTS (Jammy) and Ubuntu 24.04 LTS (Noble). Package names and executable names can differ on another release, so always verify the installed result.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Check the server before changing it

Run the installation as a user with sudo access. Confirm the Ubuntu release and identify the PHP runtime used by the web server before enabling an extension.

lsb_release -a
php -v
php --ini
php -m | grep -i imagick

The PHP command may report the CLI runtime, which is not necessarily the same PHP-FPM pool or Apache module serving WordPress. Note the PHP major and minor version and whether the site uses PHP-FPM behind a web server or Apache’s PHP module. Take a current backup and perform the first configuration on staging when possible; an encoder can change generated files without changing the original uploads, but a plugin misconfiguration can still affect the media workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install the Ubuntu packages with APT

1. Refresh package metadata

Ubuntu’s official package guidance recommends refreshing APT before installing or upgrading Debian packages:

sudo apt update

If the command reports unreachable repositories, fix DNS, repository, or proxy errors before continuing. Installing from stale metadata can produce “unable to locate package” errors even when the package exists for your Ubuntu release.

2. Install ImageMagick and the format-specific tools

sudo apt install imagemagick jpegoptim optipng pngquant gifsicle webp libavif-bin

Accept the package list only after checking that APT is using the intended Ubuntu repositories. The command installs the baseline JPEG, PNG, GIF, WebP, and AVIF toolchain in one transaction. It does not install SVGO or the PHP Imagick extension; those are handled separately.

3. Add PDF support only when required

Install Ghostscript if the WordPress workflow must rasterize PDF files into thumbnails. It is conditional: ordinary JPEG, PNG, GIF, WebP, and AVIF processing does not require it. PDF handling also deserves a security review because it introduces another file parser into the upload path.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Install SVGO for SVG files

Spatie’s optimizer documentation identifies SVGO as the SVG tool in this toolchain and documents a global npm installation:

sudo npm install -g svgo

The server therefore needs a working Node.js and npm installation first. Check both commands and record the global npm binary path:

node --version
npm --version
npm bin -g 2>/dev/null || npm prefix -g

Global npm paths can differ by Node.js installation method. If svgo works in an interactive shell but the web server cannot find it, configure the plugin with the absolute path returned by your npm installation or add that directory to the service’s PATH. Do not optimize uploaded SVG indiscriminately: SVG can contain scripts, external references, or editor metadata. Use an allowlist and sanitize files before making them publicly available.

Enable Imagick in the PHP runtime used by WordPress

Install the extension package

WordPress’s Hosting Handbook treats the Imagick PHP extension and ImageMagick as relevant media-upload capabilities. On Ubuntu, the extension package is commonly named php-imagick; if your repository uses a versioned package, search APT for the package matching the PHP version reported by the web server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
apt-cache search php-imagick
sudo apt install php-imagick

If multiple PHP versions are installed, do not assume that enabling Imagick for the CLI enables it for PHP-FPM. Check each runtime’s module list and configuration directory.

Confirm the module is loaded

php -m | grep -i '^imagick$'
php --ri imagick

A successful php --ri imagick response displays the extension’s configuration and supported ImageMagick version. If the CLI shows the module but WordPress still reports that it is unavailable, inspect the FPM or Apache runtime rather than reinstalling the same package.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Restart the correct service

After installing or enabling an extension, restart the PHP service that handles web requests. First list the available FPM units:

systemctl list-units --type=service 'php*-fpm.service'

Then restart the exact unit shown on your server, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl restart php8.3-fpm

The version in that command is an example; use the version actually installed. If Apache loads PHP directly, restart Apache instead:

sudo systemctl restart apache2

Reload the WordPress administration page and check the media or site-health screen again. A service restart is required because long-running PHP workers do not reread extension configuration for every request.

Verify every executable before configuring WordPress

Run the following checks as the account that will perform optimization, not only as root:

command -v magick || command -v convert
command -v jpegoptim optipng pngquant gifsicle cwebp avifenc svgo
magick -version 2>/dev/null || convert -version
jpegoptim --version
optipng -version
cwebp -version
avifenc --version

The first line intentionally checks both ImageMagick command names. Newer package generations commonly expose magick, while older ImageMagick 6 layouts commonly expose convert. Use the path that exists when a plugin asks for an ImageMagick executable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Symptom Likely cause Next check
magick: command not found but convert exists Older ImageMagick command layout Configure the plugin to use the convert path
cwebp is missing The WebP package is absent or not on PATH Run dpkg -s webp and command -v cwebp
avifenc is missing The AVIF package is absent or the release uses a different package build Run dpkg -s libavif-bin and inspect APT’s package metadata
svgo is missing npm’s global binary directory is not on the service PATH Run npm prefix -g and use the absolute SVGO path
Imagick is absent in WordPress The extension is enabled for a different PHP SAPI or service Compare the FPM/Apache PHP version with php --ri imagick

For a complete package record, use commands such as dpkg -s imagemagick or apt-cache policy imagemagick. This shows which repository and version APT selected instead of relying on an assumed Ubuntu release.

Connect the tools to WordPress

Installing binaries does not make WordPress call them automatically. The WordPress image editor, PHP extensions, and the particular optimization plugin must be configured to use the installed backend.

Choose the PHP image editor

In the plugin or media-processing settings, select Imagick when it is available and confirmed in the web PHP runtime. Keep GD as a fallback only if the site needs it; switching editors can change color handling, metadata behavior, supported formats, and resource usage. Do not select an executable path that passed only in your shell if the web service runs with a restricted PATH.

Enter absolute binary paths when the plugin supports them

Use the output of command -v for ImageMagick, JPEGOptim, OptiPNG, pngquant, Gifsicle, cwebp, avifenc, and SVGO. Absolute paths avoid failures caused by different environment variables between an SSH session, a cron job, PHP-FPM, and a queue worker.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set the optimization policy

Decide separately how the site treats originals, generated thumbnails, metadata, and next-generation formats. A sensible policy is to preserve an original backup, strip unnecessary metadata from public derivatives, and generate WebP or AVIF only when the theme and delivery layer can serve the correct file to compatible browsers. Do not set a single “maximum compression” value for every format; photographs, logos, screenshots, and transparent graphics have different failure modes.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use the right optimizer for each format

Input or output Recommended tool Decision to make
JPEG photographs JpegOptim, optionally followed by ImageMagick resizing Balance visual quality, file size, and whether metadata such as camera information should remain
PNG screenshots, logos, and alpha graphics OptiPNG for lossless compression; pngquant when palette reduction is acceptable Check text edges, gradients, and transparency after conversion
GIF animations Gifsicle Verify animation timing, transparency, and frame disposal
WebP cwebp from the webp package Choose lossy or lossless mode and test browser delivery through the site’s rewrite or picture-element logic
AVIF avifenc from libavif-bin Confirm browser and CDN support, encoder speed, and acceptable decode performance before enabling it globally
SVG SVGO Sanitize untrusted SVG and review visual changes caused by removing dimensions, IDs, or metadata

ImageMagick’s WebP documentation includes an important quality rule: quality values of 100 or greater select lossless mode unless lossless=false is explicitly set. A setting intended as “best quality” can therefore create much larger files than a lossy WebP. Treat quality as a format-specific compression control, not as a universal percentage.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Test with representative uploads

Use a staging site or a controlled media directory before changing production defaults. Select at least one representative file of each enabled type:

  • A camera-style JPEG with gradients and fine detail.
  • A PNG logo or screenshot with transparency and small text.
  • An animated GIF if the site accepts GIF uploads.
  • A WebP source or generated WebP derivative.
  • An AVIF file only if AVIF generation is enabled.
  • An SVG that has been reviewed and sanitized, if SVG uploads are allowed.

For each file, verify that the original upload remains available according to your retention policy, generated sizes are present, transparency and animation survive, and the browser receives the intended format. Inspect the HTML or network panel to confirm that a WebP or AVIF file is actually delivered; a generated derivative that is never selected by the theme provides no bandwidth benefit. This installation guide does not claim an independent compression benchmark, so measure your own representative media set before choosing default quality values.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot common installation failures

APT cannot find a package

Run sudo apt update again and check the Ubuntu release with lsb_release -a. Confirm that the package is available for that release with apt-cache policy package-name. Do not download an unrelated binary from an unknown source merely to satisfy a plugin; package availability and executable names vary by Ubuntu release.

The command works over SSH but not from WordPress

This is usually an environment or permission difference. Configure absolute paths, compare the PHP-FPM service account with the ownership of the upload and temporary directories, and inspect the web server and PHP logs. A global npm installation is especially likely to be outside a restricted service PATH.

Imagick appears in CLI PHP but not in WordPress

Compare php -v with the PHP-FPM unit or Apache module serving the site. Install the extension for that version, restart the correct service, and recheck the WordPress Site Health or media settings page. Avoid testing only with a command-line PHP binary when the site uses a different SAPI.

WebP files are unexpectedly large

Check whether the configured quality is 100 or higher. Under ImageMagick’s documented behavior, that selects lossless WebP unless lossless=false is set. Lower the quality within the visual target for photographs, or deliberately retain lossless mode for graphics that need exact pixel reproduction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

AVIF generation fails while other formats work

Confirm that avifenc exists and that the plugin supports AVIF output rather than merely detecting the binary. Check the plugin’s logs for an unsupported input mode, permission error, or missing temporary directory. If browser or CDN delivery is not ready, disable AVIF generation rather than creating derivatives that visitors cannot use.

PDF thumbnails fail

Install Ghostscript only when PDF thumbnails are a requirement, then verify ImageMagick’s PDF delegate and the security policy in effect on the server. A successful JPEG optimization setup does not prove that PDF rendering is enabled.

Keep the toolchain maintainable

  • Apply Ubuntu security updates and review package changes before restarting production PHP workers.
  • Keep the optimization plugin, PHP runtime, and command-line tools on compatible supported versions.
  • Monitor temporary storage and worker memory; large images can consume substantially more resources during decoding than their compressed file size suggests.
  • Retain originals or a reliable backup until the new pipeline has been validated and a rollback path is known.
  • Restrict upload permissions and sanitize SVG and PDF content before public delivery.
  • Document the executable paths and the PHP service name so a future administrator can reproduce the configuration.

When managed WordPress hosting is a better fit

If you do not want to maintain Ubuntu packages, PHP-FPM services, npm tooling, and security updates, ask a managed WordPress provider whether its platform exposes Imagick/ImageMagick, WebP, and AVIF capabilities. Confirm the exact PHP extension, supported output formats, quality controls, metadata policy, and whether you can test changes on staging. A provider’s claim that it “supports image optimization” is not equivalent to confirming that these specific backends are available to your site.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.