This is a followup question of

how do I get maximal compressed screenshots?

Is there a screenshot tool that has optipng or pngcrush already included to minimize the filesizes of the png screenshots?

I personally favoritize Shutter, but any screenshoter would be great that would create optimized pngs.

maybe there are plugins available?


If your favorite tool is "shutter" you can try to create a little plugin for it.

Creating Plugin for Shutter.

1) Make sure you have installed optipng, or install it with:

  • sudo apt-get install optipng

2) If shutter is running close it or kill it..

  • pkill shutter

3) Create a folder for the plugin and give it the correct perms. (eg:optipngplugin)

  • sudo mkdir /usr/share/shutter/resources/system/plugins/shell/optipngplugin

  • sudo chmod 755 /usr/share/shutter/resources/system/plugins/shell/optipngplugin

4) Create the script (eg:optipngplugin)

  • gksudo gedit /usr/share/shutter/resources/system/plugins/shell/optipngplugin/optipngplugin

5) Put this content in the script:

#!/usr/bin/env bash
PLUGIN_TIP=$"OptiPNG is a PNG optimizer that recompresses image files to a smaller size"
if [[ "${1}" = "name" ]];then
    echo "${PLUGIN_NAME}"
    exit 0
elif [[ "${1}" = "sort" ]];then
    echo "${PLUGIN_SORT}"
    exit 0
elif [[ "${1}" = "tip" ]];then
    echo "${PLUGIN_TIP}"
    exit 0
elif [[ "${1}" = "ext" ]];then
    echo "${PLUGIN_EXT}"
    exit 0
optipng -o7 "${FILE}"
exit 0

In my case I choose the optimization level of OptiPNG to Maximun (-o7) (very slow), and I added an image as a logo.

Man Pages

enter image description here

NOTE: Feel free to change the script according to your needs

6) Save the changes and give it perms.

sudo chmod 755 /usr/share/shutter/resources/system/plugins/shell/optipngplugin/optipngplugin

7) In my case I edited a png logo with gimp, and I saved as "optipngplugin.png" in my desktop.

enter image description here

8) copy the logo to the plugin directory (give it the same name as the plugin plus .png) and the correct permissions:

sudo cp /home/user/Desktop/optipngplugin.png /usr/share/shutter/resources/system/plugins/shell/optipngplugin/optipngplugin.png

sudo chmod 644 /usr/share/shutter/resources/system/plugins/shell/optipngplugin/optipngplugin.png

9) Test the plugin. Open shutter and take a screenshot of your desktop.

enter image description here

Right click in the screenshot and click in "Run a Plugin...", then choose "OptiPNG Plugin" from the list.

enter image description here

10) Run the plugin to recompress the screenshot you took.

enter image description here

NOTE: If you have to add something to the script or some change. you can run shutter with this command to force it to reload all plugins

  • shutter --clear_cache

Hope its help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.