Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Store.add_image() #79

Closed
augustebaum opened this issue Jul 24, 2024 · 7 comments
Closed

Implement Store.add_image() #79

augustebaum opened this issue Jul 24, 2024 · 7 comments

Comments

@augustebaum
Copy link
Contributor

augustebaum commented Jul 24, 2024

See #77 (comment)

Currently the dashboard accepts images in form of a base64-encoded with a mime-type (supported formats are SVG, PNG, JPEG and WEBP). However, there is currently no way of saving an image in a Mandr that could then be sent to the dashboard.

One issue is that we're unsure of how to detect the image's format, so we'd require the user to specify it manually every time.

All this to say, the design still needs to be specified.


For context, initially this issue was meant to help implement saving a Matplotlib, which would look something like this:

fig, ax = plt.subplots()

...

mandr.add_matplotlib(fig)

and be implemented something like this:

def insert_matplotlib(self, fig):
    figure_file = StringIO()
    fig.savefig(figure_file, format="svg")
    self.add_image(figure_file.getvalue(), type="image/svg+xml")
@thomass-dev
Copy link
Collaborator

thomass-dev commented Jul 24, 2024

Don't think this issue is mandatory here, it will come in #50 .
Adding a new image type in the JSON schema between mandr and dashboard is good ( #77 ).

@augustebaum
Copy link
Contributor Author

I opened the issue now to make sure that we have a reference to #77 (comment), which will guide the implementation

@tuscland
Copy link
Member

tuscland commented Aug 9, 2024

Is this still relevant? What is the feature behind this? Please specify the context in the issue.

@augustebaum augustebaum changed the title Implement InfoMander.add_image() Implement Store.add_image() Aug 9, 2024
@augustebaum
Copy link
Contributor Author

Added some context in the issue description

@rouk1
Copy link
Contributor

rouk1 commented Aug 12, 2024

Pillow detects the format of an opened Image.

It should help to detect the mime-type.

@tuscland tuscland added this to the Sep 4 Demo milestone Aug 13, 2024
@augustebaum augustebaum self-assigned this Aug 21, 2024
@rouk1 rouk1 removed this from the Sep 4 Demo milestone Aug 21, 2024
@tuscland
Copy link
Member

From our discussion there are several issues here:

  • What you put is what you get: we should not modify the things at insertion.
  • Display type inference: the intelligence about how an item should be displayed should be done lazily at display time
  • Storing (only) pickled objects, cause a serious problem of interoperability: more specifically, how we maintain the compatibility with user specified libraries, for example in a platform/server environment?

@augustebaum augustebaum removed their assignment Sep 2, 2024
@tuscland
Copy link
Member

tuscland commented Sep 5, 2024

Closing, because a workaround has been implemented.

Also most of the issues discussed in the previous message will be solved by #303

@tuscland tuscland closed this as completed Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants