There is a really easy way to do this. In the end what you want to achieve is to have a bock of memory(bytearray) that can be sent to the epaper screen via SPI that will display the image. The data will need to be 1 bit per pixel so 1 byte will hold the data for 8 pixels. The easist way to do this is with almost any common image editing software and edit the image till it is correct resoulution and in moncome 1 bit mode then save it as a BMP file (BMP format is without any compression and just straight image data). In your program just open this BMP file as a binary file then seek to position 55 (the fist 54 bytes are header bytes) Then just load the rest of the bytes into a buffer as is and send it to the epaper via SPI and bam the image will be there. There is some example of this at the waveshare wiki see at the bottom of https://www.waveshare.com/wiki/1.54inch_e-Paper_ModuleYou'll probably want to use CPython and something like Pillow to read in an arbitrary image, decode it, rotate it, and colorspace convert it, then write out the python source.
As I understand it you want to load the binary data from a binary file then convert it to a py file so 1 byte of biniary data will be replaced by several bytes of text data in the py file e.g 3 bytes of biniary data of zeros will look like this in py text b'\x00\x00\x00' and require a total of 15 bytes to store in the py file then MicroPython has to load this file 5 times larger into memory and compile it back into the 3 bytes it represents.
It is much easier to have image data in a biniary file and just load it directly from file to memory.