2014-04-01 23 views
0

我将图像(使用imagemagick)从png转换为bmp。当我转换的图像与不支持的MSPAINT BMP报头类型(124)命令行中的Mspaint

,无: 试图分析BMP与Python Simplecv

img=Image('im.bmp') 

返回从PIL一个错误: ..... IO错误错误被返回。

因此,由于我有很多图像要转换,是否有人知道如何用mspaint保存图像。 我可以打开油漆,但如何保存图像? 非常感谢您的任何线索 大教堂

+1

我认为你可能有更多的运气在ImageMagick中重新转换它们并使用不同的BMP格式。除了打开文件和打印等几个简单的东西外,MS Paint不能自动执行。 –

+0

“如何使用mspaint保存图像”。你可以'ctrl + s'或'file>保存|保存为“?我的回答有什么问题? – mr5

+0

感谢您的回答Alan – Dominique

回答

1

只是工作类似的东西,下面的代码为我工作,但我不知道如何关闭漆现在我做:

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)