自动无损图像压缩
smoosh的Python项目详细描述
嗯?
这是一个用python编写的压缩图像的简单脚本。通常情况下,图像并没有想象的那么小。
py解决了这个问题,它允许您压缩掉所有这些讨厌的额外字节,而不必像往常一样在“保存为web photoshop”对话框中乱动。
怎么做?
实际上,smoosh基本上只是一个脚本,它利用了令人敬畏的[smush.it](http://smush.it/)–所有图像都被发送到smush.it进行压缩–所以[小心不要发送想要保持超私有的内容](http://smush.it/faq.php)。
一切安全
SMOSHY创建了所有文件的备份,同时在图片上洒下了小精灵的灰尘。如果出了问题,你的原作不会消失在黑洞里。
另外,如果生成的smooshed文件不小于原始文件,则不会使用它。
要求
- simplejson-http://pypi.python.org/pypi/simplejson/
- python 2.5-http://www.python.org/download/releases/2.5/或更高版本(但可能不是python 3)
用法
当前目录:
cd <directory of your choice> smooshy .
特定文件/目录:
smooshy <as many files or directories as you'd like to smush here>
在python中:
from smooshy import smoosher smoosher.Smoosher(<file path).smoosh() # Smooshes the file smoosher.recursive_smoosher([<file or directory>... ]) # Smooshes all files / all files recursively in directories
安装
使用pip:
来自github:
pip install git+git://github.com/josegonzalez/smooshy.git#egg=smooshy
来自PYPI:
pip install smooshy==1
学分
很多人