Closed shalinis34 closed 7 months ago
That isn't a PNG file. It just has a .png
extension. It is actually a WebP file:
$ file gh1061.png
gh1061.png: RIFF (little-endian) data, Web/P image
$ xxd -l 64 gh1061.png
00000000: 5249 4646 3e6b 0000 5745 4250 5650 3858 RIFF>k..WEBPVP8X
00000010: 0a00 0000 1000 0000 af04 00f3 0100 414c ..............AL
00000020: 5048 e32e 0000 01a0 55db 561d db9a 1290 PH......U.V.....
00000030: 8004 2420 2112 9010 0938 4002 1222 0109 ..$ !....8@.."..
If you convert it to an actual PNG file you should be able to insert in with XlsxWriter.
Note, Excel also doesn't support the WebP format and converts that format to PNG before importing them. See my previous analysis here: https://github.com/jmcnamara/XlsxWriter/issues/1006
Closing as "Can't fix".
Current behavior
Currently throwing below error
stderr workbook.close() stderr File "C:\Python39\lib\site-packages\xlsxwriter\workbook.py", line 351, in close stderr self._store_workbook() stderr File "C:\Python39\lib\site-packages\xlsxwriter\workbook.py", line 731, in _store_workbook stderr self._prepare_drawings() stderr File "C:\Python39\lib\site-packages\xlsxwriter\workbook.py", line 1252, in _prepare_drawings stderr ) = self._get_image_properties(filename, image_data) stderr File "C:\Python39\lib\site-packages\xlsxwriter\workbook.py", line 1429, in _get_image_properties raise UnsupportedImageFormat( stderr xlsxwriter.exceptions.UnsupportedImageFormat: excel/images/StanfordHealthCare.png: Unknown or unsupported image file format.
Expected behavior
It should write image into cell without throwing exception .
Sample code to reproduce
Environment
Any other information
This PNG format image throwing unsupportedImageFormat exception
OpenOffice and LibreOffice users