mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #125] Feature request: insert_image - allow to pass in-memory graphic #105
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#105
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @petricf on GitHub (Sep 4, 2017).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/125
Originally assigned to: @jmcnamara on GitHub.
Many programs have the images inside the executable as resources. They load them from there. An explicit file is not available.
An other possibility could be that the images are created on the fly by the program logic.
lxw_worksheet only allows to insert an image from a file. So the in-memory picture must be written to an image file, inserted into the sheet and deleted afterwards.
This requested feature allows to pass a memory location / size containing the data of a picture (for example in png format) to an insert_image function derivation.
This avoids the additional disk operations and might be faster overall.
@jmcnamara commented on GitHub (Sep 5, 2017):
This feature is in the Python version of the library: worksheet.insert_image().
I'll add it to libxlsxwriter if I get a few more +1s for this feature.
@jmcnamara commented on GitHub (Aug 6, 2018):
If you would like to make a donation to accelerate this feature you can do so via PayPal or contact me directly. Currently $100 of $300.
@KengoSawa2 commented on GitHub (Aug 14, 2018):
Thank you for the great library.I respect your work:)
Although it is small amount, I donated.
I am glad if you get motivated
Open source is made of good intentions and progress.
Let's share your code, or donate!
@jmcnamara commented on GitHub (Aug 28, 2018):
I've added the initial working version of this feature to the
in_mem_imagebranch. It needs more tests and documentation but I'm sharing it now for some early feedback.An example program would look like this:
Output:
The interfaces, undocumented for now, are:
The
filenameparameter is required metadata for Excel so that images can be identified in the interface. It doesn't have to be an existing filename.In the final interface it will be optional and will be automatically replaced with
image_1_1.jpgor similar. Or the parameter may be moved to thelxw_image_optionsstruct.If you would like to try it and have any feedback, let me know.
@jmcnamara commented on GitHub (Aug 29, 2018):
Here is the revised interface:
And an example:
This will probably be the final interface.
@jmcnamara commented on GitHub (Aug 30, 2018):
This feature has been release in version 0.7.8 of libxlsxwriter.
See http://libxlsxwriter.github.io/worksheet_8h.html#aebd5cc71a42ab0e4a9ce45fe9a6f6908
Thanks to @KengoSawa2 for the sponsorship.