Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 命令行中的Mspaint_Python - Fatal编程技术网

Python 命令行中的Mspaint

Python 命令行中的Mspaint,python,Python,我将图像(使用imagemagick)从png转换为bmp。 尝试使用Python Simplecv分析bmp img=Image('im.bmp') 从PIL返回一个错误: ..…IOError:不支持的BMP标头类型(124) 使用mspaint转换图像时,不会返回任何错误 因此,由于我有很多图像要转换,有人知道如何使用mspaint保存图像吗。 我可以打开绘画,但如何保存图像? 事先非常感谢您提供的任何线索 Dom只是在处理一些类似的东西,下面的代码对我很有用,但我不确定如何关闭绘制,现

我将图像(使用imagemagick)从png转换为bmp。 尝试使用Python Simplecv分析bmp

img=Image('im.bmp')
从PIL返回一个错误: ..…IOError:不支持的BMP标头类型(124)

使用mspaint转换图像时,不会返回任何错误

因此,由于我有很多图像要转换,有人知道如何使用mspaint保存图像吗。 我可以打开绘画,但如何保存图像? 事先非常感谢您提供的任何线索
Dom

只是在处理一些类似的东西,下面的代码对我很有用,但我不确定如何关闭绘制,现在我已经完成了:

import os
import ImageGrab
SaveDirectory=r'C:\Users\????\Desktop'
sName = "Name of File"
ImageEditorPath=r'C:\WINDOWS\system32\mspaint.exe'
img=ImageGrab.grab()
saveas=os.path.join(SaveDirectory,sName + '.bmp')
img.save(saveas)
editorstring='""%s" "%s"'% (ImageEditorPath,saveas) 
os.system(editorstring)

我想你可能会更幸运地在ImageMagick中重新转换它们,并使用不同的BMP格式。除了打开文件和打印等一些简单的事情外,MS Paint无法实现自动化。“如何使用mspaint保存图像”。您只需
ctrl+s
文件>保存|另存为
?我的答案怎么了?谢谢你的回答,艾伦