用于截图后快速压缩,方便网络交流使用
=================================
相关资源
PNG压缩器横向评测:
http://css-ig.net/png-tools-overview在线PNG压缩器:
https://tinypng.com/=================================
作者:
Roman Raguet来源:
http://askubuntu.com/questions/329696/screenshot-tool-with-integrated-optipng-or-pngcrushhttp://askubuntu.com/questions/298401/how-do-i-get-maximal-compressed-screenshots1. 安装 optipng
代码:
sudo apt-get install optipng
2. 关闭 Shutter
代码:
pkill shutter
3. 创建插件目录
代码:
sudo mkdir /usr/share/shutter/resources/system/plugins/shell/optipngplugin
sudo chmod 755 /usr/share/shutter/resources/system/plugins/shell/optipngplugin
4. 创建 /usr/share/shutter/resources/system/plugins/shell/optipngplugin/optipngplugin 并加入以下内容:
代码:
#!/usr/bin/env bash
TEXTDOMAIN=shutter-plugins
TEXTDOMAINDIR=$SHUTTER_INTL
PLUGIN_NAME=$"OptiPNG Plugin"
PLUGIN_SORT=$"Recompress"
PLUGIN_TIP=$"OptiPNG is a PNG optimizer that recompresses image files to a smaller size"
PLUGIN_EXT="image/png"
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
fi
FILE="${1}"
#LOGO="/usr/share/shutter/resources/system/plugins/shell/optipngplugin/optipngplugin.png"
optipng -o6 "${FILE}"
exit 0
5. 修改权限
代码:
sudo chmod 755 /usr/share/shutter/resources/system/plugins/shell/optipngplugin/optipngplugin
6. 刷新 Shutter 的插件资料库
代码:
shutter --clear_cache
7. 使用方法:
"Screenshot" - "Run a Plugin..." - "OptiPNG Plugin"
注意事项- 可选择压缩级别:脚本倒数第二行 -o6 表示压缩级别为 6。(1最小,7最大)
- 亲测,运行慢且压缩效果不大