---
title: How to Optimize JPG and PNG Images · VitaminaWeb
description: Learn how to quickly optimize JPG and PNG images on your website without compromising their original quality.
source: https://vitaminaweb.digital/en/blog/how-to-optimize-jpg-and-png-images
lang: en
---

![How to Optimize JPG and PNG Images](https://vitaminaweb.digital/storage/blog/qzvEUq0ZE13fM7ts8XMEVN6m9ATd1HkwYJFYUV5l.webp) If you need to optimize JPG and PNG images without losing their original quality so your website loads faster, you should know about these two utility software programs (available only for Linux operating systems):

- Jpegoptim - a utility designed to optimize / compress JPG files without losing quality.
- OptiPNG - a utility designed to optimize PNG images to reduce their file size without losing any information, including transparency.

## Installing

### How to install Jpegoptim

 Below, we’ll walk you through how to install Jpegoptim on a Linux server running Ubuntu. In your terminal’s command line, run the following command: `# apt-get install jpegoptim` or `$ sudo apt-get install jpegoptim`

### How to install OptiPNG

 Below, we’ll walk you through how to install Jpegoptim on a Linux server running Ubuntu. In your terminal’s command line, run the following command: `# apt-get install optipng` or `$ sudo apt-get install optipng`

## Using the tools

### Using Jpegoptim

 In your terminal’s command line, run the following command: For a single file: `$ jpegoptim filename.jpeg` `$ jpegoptim  filename.jpeg` For multiple files in the same directory: `$ jpegoptim *.JPG`

### Using OptiPNG

 In your terminal’s command line, run the following command: For a single file: `$ optipng filename.jpeg` `$ optipng  filename.jpeg` For multiple files in the same directory: `$ optipng *.JPG`

## Important tips

- Always back up all your images before using any optimization program. If something unexpected happens, you’ll be able to quickly restore the original files.
- The utilities may change file permissions, so always make sure the image is available in your browser.

## Read also

     What's New in Digital

### [Instituto da Maturidade Digital launches Agency Directory portal, developed by VitaminaWeb](https://vitaminaweb.digital/en/blog/instituto-da-maturidade-digital-launches-agency-directory-portal-developed-by-vitaminaweb)

Instituto da Maturidade Digital launches Agency Directory, a platform developed by VitaminaWeb to organize and make it easier to discover compani...

 03 Oct, 2026 · 5 min      Development

### [All-in-One WP Migration flaw could put millions of WordPress sites at risk](https://vitaminaweb.digital/en/blog/all-in-one-wp-migration-flaw-could-put-millions-of-wordpress-sites-at-risk)

CVE-2026-19949 affects versions up to 7.109 of the popular backup and migration plugin. An attack could escalate from SQL injection to remote cod...

 03 Sep, 2026 · 5 min      Development

### [Web Application Security: A Strategic Guide from Vulnerability to Digital Maturity](https://vitaminaweb.digital/en/blog/web-application-security-a-strategic-guide-from-vulnerability-to-digital-maturity)

This guide offers an in-depth strategic analysis of the main risks, best mitigation practices, and the integration of security into the software...

 23 Feb, 2026 · 5 min
