[Bug] Insert Image to Excel returns wrong size
See original GitHub issueI have an image that has 191x47
pixels.
worksheet.addImage(imageID, {
tl: { col: column, row: row },
ext: { width: size.width, height: size.height }, // width: 191, height: 47
});
But when I open excel file, the height was automatically scaled 160%, and 157% with width.
So how can I insert the original size of an image to excel?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Problem size of picture in excel with windows 10 125
I put a picture in excel cell. My picture is a square with 44,46mm in height and width. and 100 % in height...
Read more >Excel distorts image when printing - TechNet - Microsoft
The issue is that when you place an image in an Excel spreadsheet and then print it (or even print preview it) then...
Read more >Excel printing and display scaling bug - Microsoft Community
When printing with Excel, the page layout is being affected by display scaling. I had it set at 125%. A spreadsheet that normally...
Read more >Paste as Picture Link results in distorted picture
Merged cells on the sheet you are pasting the linked picture into may be the culprit. That is what I found helped solve...
Read more >Shapes/Pictures printing distorted (eg, flattened, squashed
This seems to be a strange Excel bug ("feature"?) ... The point is, you don't want Excel to mess with the image size....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you do any modification to rows or columns, adding an image is like a crap shoot. I have an image that I have modified to be 96 DPI and know the pixel size height and width.
Using ext with height and width results in Excel barfing and having to fix all the images – Drawing at sheet X…
Using tl and br produces an image scaled to 30% because I have the height of the row at 51. Setting the br.row to anything under 0 will reduce to 30%. Setting br.row to 1 or above will scale correctly. Problem is I have an image I want to fit in the row because the bottom of the row has a double border. Setting br.row to 1 overlaps the border (looks like crap). Setting br.row to 0.9999 ends up with a scale of 30% (I’m assuming because the default row height is 15 and the new height is 51 and 15/51 is 0.29999 – guessing.
In any case, addImage is majorly buggy and should be identified as ‘beta’. Certainly not covering some simple conditions of rows and columns.
We had a similar experience working with the library. When using width and height with tl and br parameters, then width and height are getting ignored.