jupyter-widgets / ipydatagrid

Fast Datagrid widget for the Jupyter Notebook and JupyterLab
BSD 3-Clause "New" or "Revised" License
580 stars 51 forks source link

Include jpeg in cell? #253

Closed joseberlines closed 9 months ago

joseberlines commented 3 years ago

Include jpeg in cell? Is it possible to display jpegs in cells?

ibdafna commented 3 years ago

Hello @joseberlines 👋

It's not possible to display JPEG/PNG or any other images in a ipydatagrid cell. Would you be able to elaborate on your use case?

Many thanks

joseberlines commented 3 years ago

Use case: a product/company comparison table. Imagine a table where a company financial values have to be compared (and/or edited). On every column name you might write APPLE INC, MICROSOFT whatever, but instead it's much nicer to include the logo. Of course the logo might be any pic type (jpg png whatever) since they could be converted with PIL probably. Another example is product comparison as the tables you get when you google "nikon SLR D5000 vs CANON EOS 50" on the top of every column again you might have the name of the product or a pic of the product (or both actually). Please comment if it is not clear.

joseberlines commented 3 years ago

As example including a jpeg in ipydatagrid would allow the following: Screenshot_20210731-002751_DuckDuckGo.jpg

joseberlines commented 3 years ago

Or put in other way it would allow to include symbols on the column names in situations like this: []()Screenshot_20210731-003025_DuckDuckGo.jpg

ibdafna commented 3 years ago

This will probably inherit from the widget ABC class I describe in #262. The main thing here is that we also need to work with binary data for the image which, in some cases, will be serialized from the Python side (unless it's retrieved via a fetch request from a 3rd source in the browser). This will increase the complexity during the serialization proces. @martinRenou any thoughts on this?

martinRenou commented 3 years ago

I believe we can do this :) I've seen beakerx people using images inside lumino datagrid cells.

It would be nice to upstream such an ImageRenderer class to Lumino.

ibdafna commented 3 years ago

In the case of using an image from the hard drive, are they saving it as a blob and then rendering? What would this look like on the Lumino side of things?

EDIT: will take a look at what they're doing

jgunstone commented 1 year ago

+1 :)

martinRenou commented 1 year ago

Preparing the upstream work to allow this in ipydatagrid: https://github.com/jupyterlab/lumino/pull/630