docs: def build_image(self, msg):
          """Convert base64 encoding to png.
  
          Strips msg of the base64 image encoding and outputs
          the images to the specified directory.
          """
          result = self.find_message(msg)
  
          if result is None:
              return
  
          self.index += 1
          images_path = 'images'
  
          if self.directory:
              images_path = os.path.join(self.directory, images_path)
  
          if not os.path.isdir(images_path):
              os.makedirs(images_path)
  
          with open('{0}/output_{1}.png'.format(images_path, self.index), 'wb') as fh:
              self.write_image_to_disk(msg, result, fh)
  
          self.out.append(
              '\n![png]({0}/output_{1}.png)\n'.format(images_path, self.index))