question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

insert_image will not insert png file

See original GitHub issue

insert_image will not insert png file

Hi,

I am using XlsxWriter to insert_image but it appears give an error saying cannot identify image file.

I am using Python version 2.7 with django and XlsxWriter 0.9.2 and Excel version 2010.

See stackoverflow question

Here is some code that demonstrates the problem:


frontSheet.insert_image('B1', 
                        '/opt/folder/cc.png', 
                        {'x_scale': 0.5, 'y_scale': 0.5})

cc

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
jmcnamaracommented, Sep 30, 2016

Can you post the output of the following three commands run against the image file used in that example:

 ls -l cc.png 
 sum cc.png 
 file cc.png
1reaction
jmcnamaracommented, Sep 30, 2016

I suspect the image file may be empty. That would generate an error similar to what you are seeing:

$ cd xlsxwriter/examples
$ echo > logo.png 
$ python demo.py 
  Traceback (most recent call last):
  File "demo.py", line 33, in <module>
    workbook.close()
  File ".../workbook.py", line 297, in close
  File ".../workbook.py", line 593, in _store_workbook
  File ".../workbook.py", line 1018, in _prepare_drawings
  File ".../workbook.py", line 1094, in _get_image_properties
  struct.error: unpack requires a string argument of length 3

Post the output from the above commands and we’ll see.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot insert picture from file - Microsoft Community
I am using Word 16.42 on a mac, and I cannot insert a picture from file, that option (Insert > Pictures > Picture...
Read more >
How to Insert a Picture in Word - CustomGuide
1. Click in your document where you want to insert your picture. 2. Click the Insert tab. 3. Click Pictures button.
Read more >
How To Insert image in Word Document app on phone
hello, in this tutorial we'll see how to insert images into Word Document App on phoneSee How to Convert Handwriting Image to Text...
Read more >
Insert Picture in Word Document (and wrap text / without ...
Insert picture in word document ? Let's do it! In this tutorial I will show you how to insert an image in Word...
Read more >
Copy, insert graphics - Adobe Support
Learn to place graphics, import images, and insert pictures or other Adobe files into InDesign documents.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found