MCPcopy
hub / github.com/Aider-AI/aider / read_image

Method read_image

aider/io.py:435–451  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

433 return Style.from_dict(style_dict)
434
435 def read_image(self, filename):
436 try:
437 with open(str(filename), "rb") as image_file:
438 encoded_string = base64.b64encode(image_file.read())
439 return encoded_string.decode("utf-8")
440 except OSError as err:
441 self.tool_error(f"{filename}: unable to read: {err}")
442 return
443 except FileNotFoundError:
444 self.tool_error(f"{filename}: file not found error")
445 return
446 except IsADirectoryError:
447 self.tool_error(f"{filename}: is a directory")
448 return
449 except Exception as e:
450 self.tool_error(f"{filename}: {e}")
451 return
452
453 def read_text(self, filename, silent=False):
454 if is_image_file(filename):

Callers 1

read_textMethod · 0.95

Calls 1

tool_errorMethod · 0.95

Tested by

no test coverage detected