Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Table of images or thumbnails please ?? #800

Description

@Nabilcobain

I don't know if this is what you are looking for but I managed to put the images in a table (bootstrap component) through a workaround.
Through the following function I transformed them into thumbnails and then wrote them in html components.

def get_thumbnail(path):   
   i = Image.open(path)
   i.thumbnail((100, 100), Image.LANCZOS)
   buff = BytesIO()
   i.save(buff, format="PNG")
   encoded_image = base64.b64encode(buff.getvalue()).decode('UTF-8')
   return (html.Img(src='data:image/png;base64,{}'.format(encoded_image)))

At this point I put them in a column of a pandas dataframe in the layout.

html.Div([
        dbc.Table.from_dataframe(pandas_df, striped=True, bordered=True, hover=True, responsive="sm")
        ],
        style = {'margin-right':'90px','margin-left':'90px'})

This is the result:
Cattura

P.S.

import dash_html_components as html
import dash_bootstrap_components as dbc`

Originally posted by @ricky1192 in #383 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions