-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pack images into epub #194
Comments
Hi, I managed to add images with the following code: file_name = unique_jpg_image_title
ei = epub.EpubImage()
ei.file_name = file_name
ei.media_type = 'image/jpeg'
ei.content = binary_file_content
book.add_item(ei)
I only tried with jpeg images. I guess other image types would also work. |
Thank you! I also find a related PR here Add an example for embedding images into paragraph
|
Suggest merging this! I am currently wasting time looking at issues and other discussion to see exactly how to do this! |
Temporarily, I use
book.setcover()
to pack images into epub.After unzipping the epub file, part of it looks like
And it works
View image
I have gone through all the samples in this repo, but didn't find a similar example. So now I have two questions:
I won't see
images2.jpg
, what's the possible reason?What the epub file looks like after unzipping
The
images
folder containsimage2.jpg
and I can see those images by accessingabout.xhtml
but I couldn't seeimage2.jpg
through epub.Here is my working code if you have images named
cover.jpg
andtry.jpg
View code
That code will throw a warning
But that doesn't matter.
The text was updated successfully, but these errors were encountered: