convert Imagemagik实用程序和python PIL con之间的差异

2024-09-25 04:33:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用convert Imagemagik实用程序创建灰度jpg图像。需要帮助在Python中找到等效的实用程序。我尝试了PIL,但这会创建png图像。 我想通过python调用“convert”实用程序。还有比这更好的解决办法吗。 我想在tensorflow中输入图像。问题是我使用的是tensorflow 1.1


Tags: 图像实用程序convertpilpngtensorflow灰度jpg
1条回答
网友
1楼 · 发布于 2024-09-25 04:33:21

嗯?这可以很好地工作并创建一个灰色JPEG:

from PIL import Image
image=Image.open('start.png')
grey=image.convert('L')
grey.save("result.jpg")

相关问题 更多 >