Provides TinyPNG integration.

What does TinyPNG do?

TinyPNG uses smart lossy compression techniques to reduce the file size of your PNG files. By selectively decreasing the number of colors in the image, fewer bytes are required to store the data. The effect is nearly invisible but it makes a very large difference in file size!

Why should I use TinyPNG?

PNG is useful because it's the only widely supported format that can store partially transparent images. The format uses compression, but the files still can be large. Use TinyPNG to shrink images for your apps and sites. It will use less bandwidth and load faster. For more information about TinyPNG please visit

For more information about TinyPNG please visit

Drupal 7

How does it work?

For Drupal 7 this module creates a new ImageToolkit which uses other toolkits in the background. The secondary toolkit could be the core GD or the ImageMagick toolkit provided by ImageMagick module. TinyPNG module just calls the functions of the secondary toolkit in the background but in the last step it sends the image to the TinyPNG API to compress it.



Download Tinify PHP (v1.3.1+) library from and place it under $DRUPAL_ROOT/sites/all/libraries.

After Tinify PHP library installation the Tinfiy.php should be found at $DRUPAL_ROOT/sites/all/libraries/tinify-php/lib/Tinify.php

Tinify-PHP library placement

Then install the module as you would normally install a contributed Drupal module. See: for further information.

Installation via Drush

If you install tinypng module via drush command: drush en tinypng, the library will be downloaded and placed the proper place. The module provides a separate Drush command for easy installation just of the Tinify-PHP library too: drush tinypng-library.


  1. Having installed the module, go to admin/config/media/image-toolkit page and select TinyPNG as default Image toolkit and save the form.
  2. Then set your TinyPNG API key, select the secondary toolkit and save the form.
  3. Configure the secondary toolkit too.

Drupal 8


  1. Go to your site’s root directory and run composer require tinify/tinify:1.4.*.
  2. Enable TinyPNG in the Drupal admin.

Note: we are assuming that you have a Composer based Drupal installation, where the docroot (usually called www) is not the same as the site’s root directory but a subdirectory in that. For more info, see:


Having installed the module, go to /admin/config/tinypng page and set your TinyPNG API key. On the same page you can select the mode you want to compress images.

With Compress on upload mode you will compress images when they are uploaded.

With Enable TinyPNG image action mode you will have the opportunity to keep your original image untouched and select the image styles you want to compress. When this mode is enabled you can add TinyPNG effect to any of your image styles.


  • Make the file size displayed after upload the compressed image size rather than the original. After refreshing the page the filesize is correctly displayed.
  • Create a service to provide this module’s functionality for other modules to integrate.
  • Implement ImageMagick toolkit operation
Supporting organizations: 

Project information