panel.pane.image module#

Contains Image panes including renderers for PNG, SVG, GIF and JPG file types.

class panel.pane.image.FileBase(object=None, **params)[source]#

Bases: HTMLBasePane

Methods

applies(obj)

Returns boolean or float indicating whether the Pane can render the object.

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

embed = Boolean(default=False, label='Embed')

Whether to embed the file as base64.

classmethod applies(obj: Any) float | bool | None[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

class panel.pane.image.GIF(object=None, **params)[source]#

Bases: ImageBase

The GIF pane embeds a .gif image file in a panel if provided a local path, or will link to a remote image if provided a URL.

Reference: https://panel.holoviz.org/reference/panes/GIF.html

Example:

>>> GIF(
...     'https://upload.wikimedia.org/wikipedia/commons/b/b1/Loading_icon.gif',
...     alt_text='A loading spinner',
...     link_url='https://commons.wikimedia.org/wiki/File:Loading_icon.gif',
...     width=500
... )

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

panel.pane.image.ImageBase: alt_text, caption, fixed_aspect, link_url

class panel.pane.image.ICO(object=None, **params)[source]#

Bases: ImageBase

The ICO pane embeds an .ico image file in a panel if provided a local path, or will link to a remote image if provided a URL.

Reference: https://panel.holoviz.org/reference/panes/ICO.html

Example:

>>> ICO(
...     some_url,
...     alt_text='An .ico file',
...     link_url='https://en.wikipedia.org/wiki/ICO_(file_format)',
...     width=50
...

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

panel.pane.image.ImageBase: alt_text, caption, fixed_aspect, link_url

class panel.pane.image.Image(object=None, **params)[source]#

Bases: ImageBase

The Image pane embeds any known image format in a panel if provided a local path, bytes or remote image link.

Example:

>>> Image(
...     'https://panel.holoviz.org/_static/logo_horizontal.png',
...     alt_text='The Panel Logo',
...     link_url='https://panel.holoviz.org/index.html',
...     width=500
... )

Methods

applies(obj)

Returns boolean or float indicating whether the Pane can render the object.

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

panel.pane.image.ImageBase: alt_text, caption, fixed_aspect, link_url

classmethod applies(obj: Any) float | bool | None[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

class panel.pane.image.ImageBase(object=None, **params)[source]#

Bases: FileBase

Encodes an image as base64 and wraps it in a Bokeh Div model. This is an abstract base class that needs the image type to be specified and specific code for determining the image shape.

The filetype determines the filetype, extension, and MIME type for this image. Each image type (png,jpg,gif) has a base class that supports anything with a _repr_X_ method (where X is png, gif, etc.), a local file with the given file extension, or a HTTP(S) url with the given extension. Subclasses of each type can provide their own way of obtaining or generating a PNG.

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

alt_text = String(allow_None=True, label='Alt text')

alt text to add to the image tag. The alt text is shown when a user cannot load or display the image.

caption = String(allow_None=True, label='Caption')

Optional caption for the image.

fixed_aspect = Boolean(default=True, label='Fixed aspect')

Whether the aspect ratio of the image should be forced to be equal.

link_url = String(allow_None=True, label='Link url')

A link URL to make the image clickable and link to some other website.

class panel.pane.image.JPG(object=None, **params)[source]#

Bases: ImageBase

The JPG pane embeds a .jpg or .jpeg image file in a panel if provided a local path, or will link to a remote image if provided a URL.

Reference: https://panel.holoviz.org/reference/panes/JPG.html

Example:

>>> JPG(
...     'https://www.gstatic.com/webp/gallery/4.sm.jpg',
...     alt_text='A nice tree',
...     link_url='https://en.wikipedia.org/wiki/JPEG',
...     width=500
... )

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

panel.pane.image.ImageBase: alt_text, caption, fixed_aspect, link_url

class panel.pane.image.PDF(object=None, **params)[source]#

Bases: FileBase

The PDF pane embeds a .pdf image file in a panel if provided a local path, or will link to a remote image if provided a URL.

Reference: https://panel.holoviz.org/reference/panes/PDF.html

Example:

>>> PDF(
...     'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
...     width=300, height=410
... )

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

start_page = Integer(default=1, inclusive_bounds=(True, True), label='Start page')

Start page of the pdf, by default the first page.

class panel.pane.image.PNG(object=None, **params)[source]#

Bases: ImageBase

The PNG pane embeds a .png image file in a panel if provided a local path, or will link to a remote image if provided a URL.

Reference: https://panel.holoviz.org/reference/panes/PNG.html

Example:

>>> PNG(
...     'https://panel.holoviz.org/_static/logo_horizontal.png',
...     alt_text='The Panel Logo',
...     link_url='https://panel.holoviz.org/index.html',
...     width=500
... )

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

panel.pane.image.ImageBase: alt_text, caption, fixed_aspect, link_url

class panel.pane.image.SVG(object=None, **params)[source]#

Bases: ImageBase

The SVG pane embeds a .svg image file in a panel if provided a local path, or will link to a remote image if provided a URL.

Reference: https://panel.holoviz.org/reference/panes/SVG.html

Example:

>>> SVG(
...     'https://upload.wikimedia.org/wikipedia/commons/6/6b/Bitmap_VS_SVG.svg',
...     alt_text='A gif vs svg comparison',
...     link_url='https://en.wikipedia.org/wiki/SVG',
...     width=300, height=400
... )

Methods

applies(obj)

Returns boolean or float indicating whether the Pane can render the object.

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

panel.pane.image.ImageBase: alt_text, caption, fixed_aspect, link_url

encode = Boolean(default=True, label='Encode')

Whether to enable base64 encoding of the SVG, base64 encoded SVGs do not support links.

classmethod applies(obj: Any) float | bool | None[source]#

Returns boolean or float indicating whether the Pane can render the object.

If the priority of the pane is set to None, this method may also be used to define a float priority depending on the object being rendered.

class panel.pane.image.WebP(object=None, **params)[source]#

Bases: ImageBase

The WebP pane embeds a .webp image file in a panel if provided a local path, or will link to a remote image if provided a URL.

Reference: https://panel.holoviz.org/reference/panes/WebP.html

Example:

>>> WebP(
...     'https://assets.holoviz.org/panel/samples/webp_sample.webp',
...     alt_text='A nice tree',
...     link_url='https://en.wikipedia.org/wiki/WebP',
...     width=500,
...     caption='A nice tree'
... )

Parameter Definitions


Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: margin, default_layout, object

panel.pane.markup.HTMLBasePane: enable_streaming

panel.pane.image.FileBase: embed

panel.pane.image.ImageBase: alt_text, caption, fixed_aspect, link_url