View Single Post
Old 04-22-2019, 12:49 PM   #1
nirosan
Member
nirosan began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Jul 2017
Device: epub
Is it possible to add image file via plugin?

Hi,

I am trying to write a plugin which generate math formulas as image.
Is it possible to add the generated image file to ebook?
If yes how can I do this?

What I have tried:
Quote:
image_path = get_abspath_of_rendered_file()
with open(image_path, "rb") as imageFile:
str = base64.b64encode(imageFile.read())
self.bk.addfile("MathmMlid", "MathMLImage", str, "image/png", properties=None, fallback=None,overlay=None)
but nothing happens.

Quote:
image_path = get_abspath_of_rendered_file()
self.bk.addfile("MathmMlid", "MathMLImage", image_path, "image/png", properties=None, fallback=None,overlay=None)
file.close()
but luncher crashed.

I have already checked the image file exists.


Thank you
nirosan is offline   Reply With Quote