Solution
add the following code to the PY header of the operation picture:
from PIL import JpegImagePlugin
JpegImagePlugin._getmp = lambda x:None
mime = mimetypes.types_ Map [true] [ext]
keyerror: ‘. MPO’
the above error occurs when using openpyxl to operate the pictures in Excel. Baidu has not. After a visit to Google, it is found that there is an image MIME type of. MPO, and the pictures in my excel are clearly in. PNG format
examples are as follows:
>>> import PIL.Image
>>> img = PIL.Image.open('bob a.jpg')
>>> img.format
'MPO'
>>> PIL.PILLOW_VERSION
'2.7.0'
First of all, you should know that openpyxl uses pilot to identify images. After Google found that this PNG image is recognized as an. MPO file by pilot, Openpyxl does not support
while images in MPO format are very similar to JPEG images
it may be that an additional flag is added when the pilot recognition format is JPEG or PNG and marked as MPO
so we can add the above two lines of code before importing any image and before the pilot recognition image (I don’t know what he means. The jpeimageplugin is used by the pilot to process images. It should not add any suffix to the source image).
Reference link
using openpyxl: keyerror: ‘. MPO’ while saving excel workbook
k
JPEG image being identified as MPO
Read More:
- import Error:Missing optional dependency ‘openpyxl‘. Use pip or conda to install openpyxl
- [Python] pandas Library pd.to_ Parameter arrangement and example of Excel operation writing into excel file
- Openpyxl foreign tutorial, written very well
- Several common methods of inserting pictures into latex documents
- To solve the problem of C # calling excel interface error, prompt: the COM object of Microsoft. Office. Interop. Excel. Applicationclass is forcibly converted to the interface type “Microsoft. Offi”
- The. Exe crashed program ends abnormally when the QT project is copied to the new environment
- How to Compress them with thumbrails When uploading pictures
- Causes and solutions of WordPress media library pictures not showing or showing errors
- Error in loading online pictures on billboard in cesium tainted canvas may not be loaded
- python keyerror(0)
- Solve the problem that “figure size 640×480 with 1 axes” does not display pictures in jupyter notebook
- Python modifies word document content and inserts pictures
- Read multiple sheets of an excel file according to npoi
- Solutions to Excel 2007 “cannot shift object off sheet”
- Solution for GitHub unable to open pictures
- Error loading password’s fault file (MySQL for Excel)
- The built-in filter function in Excel can’t contain all the items
- SSIS Error Code DTS_E_OLEDB_EXCEL_NOT_SUPPORTED
- In win10 environment, Ctrl + C cannot be copied and Ctrl + V cannot be pasted
- Solutions to problems in SAS 9.3 x64 importing and exporting Excel