ipydatagrid icon indicating copy to clipboard operation
ipydatagrid copied to clipboard

Include jpeg in cell?

Open joseberlines opened this issue 3 years ago • 7 comments

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

joseberlines avatar Jul 28 '21 22:07 joseberlines

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

ibdafna avatar Jul 29 '21 17:07 ibdafna

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 avatar Jul 30 '21 18:07 joseberlines

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

joseberlines avatar Jul 30 '21 22:07 joseberlines

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

joseberlines avatar Jul 30 '21 22:07 joseberlines

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?

ibdafna avatar Aug 15 '21 04:08 ibdafna

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.

martinRenou avatar Aug 16 '21 07:08 martinRenou

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

ibdafna avatar Aug 16 '21 17:08 ibdafna

+1 :)

jgunstone avatar Aug 21 '23 10:08 jgunstone

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

martinRenou avatar Sep 06 '23 12:09 martinRenou