How to Compress PNG Images Without Losing Transparency and Quality

Learning how to compress PNG images without losing quality has lots of SEO benefits. PNG (Portable Network Graphic ) is a popular image format used on the web. It is the best for digital images with transparency, sharp edges, text and line art, and those with a wide range of colors.

PNG images are known for their lossless compression, which means that the image quality and transparency are preserved while reducing the file size. The format is best for images that require a transparent background, such as icons, logos, and illustrations.

However, PNG files are usually larger compared to JPEG.  You may need to compress them further to reduce the file size.

Here’s how to compress PNG images without losing transparency and quality:

Use an Image Editing Software

An image editing software gives you control over the optimization process. You can tailor the compression settings to match your needs while maintaining the transparency and quality of your PNG images.

Popular image editing software you can use include Adobe Photoshop or Gimp.

Adobe Photoshop

To compress PNG images in Photoshop,

  • Open the PNG image in Photoshop.
  • Make a copy of the image (optional) before making changes. This way, you can always go back to the original if needed.
  • Go to “File”>“Export”>“Export As
  • Choose “PNG” as the format
  • You will see settings for PNG export. Adjust;

    Image size: Ensure the dimensions match your original image and maintain the aspect ratio to avoid distortion.
    Quality: Set this to 100% for maximum quality
    PNG options: Select “PNG-24” to preserve transparency
  • Click “Export” and save your PNG image.

Alternatively, use the “Save for Web” feature in Photoshop. To do this,

  • Open the PNG image in Photoshop
  • Click “File” in the menu bar>”Save for Web
  • Adjust the Preset, Optimized, Percent, Quality, or Image Size settings to maintain quality and transparency
  • Preview the compressed PNG file with different qualities and file sizes 
  • Click the download icon, then save the compressed image

GIMP (GNU Image Manipulation Program)

GIMP is a free and open-source image editor.

Step 1: Launch GIMP on your computer.

Step 2: Open the PNG image you want to compress by going to “File” > “Open,” then select the file from your computer.

Step 3: Go to “File” > “Export As.”

Step 4: In the “Export Image” dialog box that opens, choose the destination folder where you want to save the compressed image.

Step 5: Click “Select File Type (by extension)” and select “PNG image” as the file type.

Step 6: Configure Compression Settings.

  • Compression Level: Adjust the compression level to control the amount of compression. A higher value (e.g., 9) results in minimal compression with no quality loss. Lower values (e.g., 1) apply more compression, reducing file size but potentially affecting image quality.
  • Interlace: You can choose “Adam7 (Best quality)” or “None” for interlacing. Interlacing makes the image display more smoothly during loading but might increase the file size slightly.
  • Save background color: Check this option to preserve transparency in the image.
  • Save resolution: Ensure the resolution settings are accurate. It will preserve the metadata regarding resolution. 

Step 7: Before exporting, click the “Export” button to open the PNG Export dialog and preview the image.

Step 8: Once you’re satisfied with the settings and the preview, click “Export” to save the compressed image.

When using an image editor, always preview the compressed image to ensure it meets the quality standards.

Install a WordPress Image Optimization Plugin

An image optimization plugin compresses images to reduce their file size. Many plugins offer both lossless and lossy compression options.

Lossless compression retains the original quality while reducing the file size. Lossy compression reduces quality slightly for more reduction in file size. To compress PNG images without losing transparency and quality, use lossless compression.

Examples of image compression plugins for WordPress include

  • Smush: A popular plugin that offers both lossless and lossy compression.
  • Imagify: Has three levels of image compression and is integrated with popular page builders and e-commerce plugins.
  • ShortPixel: Known for its simplicity and ease of use, it offers both lossy and lossless compression and supports multiple image formats.
  • EWWW Image Optimizer: Supports various file formats and has advanced options for developers.


To compress your PNG images with a WordPress plugin, you first need to install and activate the plugin. Configure the settings by selecting lossless compression and the level of compression. Note that higher compression levels result in some quality loss.

Use PNG Quantization

PNG or color quantization reduces the number of unique colors in a PNG image. This is done by simplifying the image’s color palette, which can result in a smaller file size. As illustrated in the image below, the downside of PNG quantization is the distortion of boundaries in areas with gradual color transitions.

An example distortion of boundaries when compressing PNG Images

Error diffusion dithering (EDD), an image processing technique, helps resolve this problem as it computes the error between the pixel value and its nearest representative.

PNG quantization involves;

Reducing the Number of Colors

PNG images use a palette of colors to represent the image. Each pixel in the image is associated with a specific color from this palette. PNG quantization creates a smaller, optimized palette to represent the entire image.

Reducing Color Depth

Limiting the number of colors in the palette reduces the image’s color depth. The maximum number of colors in an image is determined by the number of binary bits defining every pixel’s color or shade. For example, you can save a 32-bit image as a 24-bit or 8-bit image.

Dithering

Dithering introduces patterns or noise into an image. Here’s an example of an image after dithering:

example of image noiese after dithering while compressing PNG Images

This creates the illusion of additional colors and smoother transitions between colors, which is useful when reducing the number of colors in an image to maintain quality.

Lossless and Lossy Quantization

PNG quantization can be either lossless or lossy. You can achieve greater compression, lose some quality, or preserve the original quality for lesser compression.

Transparency Preservation

PNG images can contain transparency (alpha) information. Effective quantization should ensure that transparency and transparency-related information are preserved.

To quantize your PNG images, use a software tool like ImageMagick, TinyPNG, RIOT, and Color Quantizer.

Online image compression tools are convenient, easy to use, and don’t require installing software. They also work on different operating systems and can handle large image files, which can be helpful for high-resolution photographs and graphics.

Pick a tool, visit the website, and upload the PNG image you want to compress. Most tools support drag-and-drop functionality, or you can use a file upload button.

Some tools offer options for configuring the level of compression. You can often choose between lossless and lossy compression, adjust the quality, and set other parameters depending on the tool.

After configuring the settings, click the “Compress” or “Optimize” button to start the compression process. The tool will process your image and display the optimized version.

Popular online image compression tools include:

Convert to WebP

Depending on your compression needs, you can convert your PNG images into formats that offer better compression without compromising quality.

WebP is a modern image format that significantly reduces file size while maintaining high image quality and transparency. You can also use image editing software like Adobe Photoshop or GIMP. 

Alternatively, choose a WordPress image optimization plugin with features for converting PNG to WebP format.

Compress PNG Images for Web

Knowing how to compress PNG images without sacrificing transparency and quality is essential for web developers, designers, and anyone who works with visuals on the web.

You can significantly reduce file sizes. It leads to faster loading of web pages, improved user experiences, and more efficient storage utilization.

The key to successful compression lies in striking the right balance between smaller file sizes and maintaining the quality of your PNG images.

With these techniques, you don’t have to sacrifice the visual integrity of your images to achieve optimal performance.

Karol Carter
Karol Carter

Karol Carter is an experienced author and expert in various aspects of web development, online business, and digital marketing. Having worked with notable companies such as Automattic, Adobe, Ahrefs, Ecommerce Platforms, WebsiteSetup.org, WPAstra.com, CodeinWP, WinningWP, and Smashing Magazine, Karol has honed a wide range of skills and knowledge in the industry. From monetizing a blog to understanding the basics of SEO, designing websites, creating engaging content, and optimizing online visibility, Karol has covered it all.

Articles: 31