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

Method pil_image_to_uri

_plotly_utils/basevalidators.py:2386–2396  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

2384
2385 @staticmethod
2386 def pil_image_to_uri(v):
2387 in_mem_file = io.BytesIO()
2388 v.save(in_mem_file, format="PNG")
2389 in_mem_file.seek(0)
2390 img_bytes = in_mem_file.read()
2391 base64_encoded_result_bytes = base64.b64encode(img_bytes)
2392 base64_encoded_result_str = base64_encoded_result_bytes.decode("ascii")
2393 v = "data:image/png;base64,{base64_encoded_result_str}".format(
2394 base64_encoded_result_str=base64_encoded_result_str
2395 )
2396 return v
2397
2398
2399class CompoundValidator(BaseValidator):

Callers 3

validate_coerceMethod · 0.95
encode_as_pilMethod · 0.80
clean_to_json_compatibleFunction · 0.80

Calls 5

readMethod · 0.80
saveMethod · 0.45
seekMethod · 0.45
decodeMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected