我正在尝试为我的网络应用程序实现图像压缩。虽然压缩对于 PNG 图像效果很好(实际压缩可以忽略不计,但没有错误),但对于 JPG 和 JPEG 图像则失败。
运行 Pillow 测试会产生以下输出:
Pillow 4.1.0 TEST SUMMARY
--------------------------------------------------------------------
Python modules loaded from /usr/local/lib/python2.7/dist-packages/PIL
Binary modules loaded from /usr/local/lib/python2.7/dist-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok
*** TKINTER support not installed
--- FREETYPE2 support ok
*** LITTLECMS2 support not installed
*** WEBP support not installed
--- JPEG support ok
*** OPENJPEG (JPEG2000) support not installed
--- ZLIB (PNG/ZIP) support ok
*** LIBTIFF support not installed
--------------------------------------------------------------------
Running selftest:
--- 58 tests passed.
Run Code Online (Sandbox Code Playgroud)
一切看起来都不错,但是当运行我的示例代码时,我收到以下错误:
Wrong JPEG …Run Code Online (Sandbox Code Playgroud)