code: def save_as(image_data: bytes, output_name: str, file_type: str):
      try:
          from PIL import Image
  
          m = Image.open(BytesIO(image_data))
          m.load()
          color = (255, 255, 255)
          b = Image.new("RGB", m.size, color)
          # BUG for Mac:
          #   b.paste(m, mask=m.split()[3])
          b.paste(m)
          b.save(output_name, file_type, quality=100)
      except ModuleNotFoundError:
          raise Exception(
              f"Please install PIL for {file_type} image type"
          )
  
file_path: pyecharts/pyecharts/render/snapshot.py
imports: import base64
  import codecs
  import logging
  import os
  from io import BytesIO
  from ..types import Any
label_desc: Use image node_id 5 for calling a global function with example usage: save_as(image_data, output_name, file_type) without return types