赞
踩
用labelme.exe打开一个有好几张图的文件夹的时候,可能会闪退。但是也看不到是什么错误,没有弹窗错误提示。
这个时候,可以从命令行打开exe文件,或者用python的pip安装labelme。从命令行启动labelme之后,再次打开图像文件夹。还是会闪退,但是能看到报错了。
- Traceback (most recent call last):
- File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\PIL\JpegImagePlugin.py", line 630, in _save
- rawmode = RAWMODE[im.mode]
- KeyError: 'RGBA'
-
- The above exception was the direct cause of the following exception:
-
- Traceback (most recent call last):
- File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\labelme\app.py", line 1110, in fileSelectionChanged
- self.loadFile(filename)
- File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\labelme\app.py", line 1510, in loadFile
- self.imageData = LabelFile.load_image_file(filename)
- File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\labelme\label_file.py", line 66, in load_image_file
- image_pil.save(f, format=format)
- File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\PIL\Image.py", line 2212, in save
- save_handler(self, fp, filename)
- File "d:\Users\qqyor\anaconda3\envs\py37\lib\site-packages\PIL\JpegImagePlugin.py", line 632, in _save
- raise OSError(f"cannot write mode {im.mode} as JPEG") from e
- OSError: cannot write mode RGBA as JPEG
原因是图像是rgba四个通道的,第四个通道是透明通道。
把图片转换一下成三通道的图像试试,一般可以解决。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。