MCPcopy Index your code
hub / github.com/plotly/plotly.py / encode_as_pil

Method encode_as_pil

_plotly_utils/utils.py:330–336  ·  view source on GitHub ↗

Attempt to convert PIL.Image.Image to base64 data uri

(obj)

Source from the content-addressed store, hash-verified

328
329 @staticmethod
330 def encode_as_pil(obj):
331 """Attempt to convert PIL.Image.Image to base64 data uri"""
332 image = get_module("PIL.Image")
333 if image is not None and isinstance(obj, image.Image):
334 return ImageUriValidator.pil_image_to_uri(obj)
335 else:
336 raise NotEncodable
337
338
339class NotEncodable(Exception):

Callers

nothing calls this directly

Calls 2

get_moduleFunction · 0.90
pil_image_to_uriMethod · 0.80

Tested by

no test coverage detected