ebooklib icon indicating copy to clipboard operation
ebooklib copied to clipboard

get image content to show from epub .

Open catafest opened this issue 7 years ago • 1 comments

I want to show images from epub file. I used the default example and I need to get content image to show into PyQt4

import ebooklib
from ebooklib import epub

book = epub.read_epub('my_example.epub')

for a in book.get_items_of_type(ebooklib.ITEM_IMAGE):
    print a

The result come with : EpubImage:id66:images/00146.jpeg

catafest avatar Jul 23 '17 19:07 catafest

You can use .get_content() method to get content of the image. So just do for a in book.get_items_of_type(ebooklib.ITEM_IMAGE): image_raw = a.get_content() Variable image_raw will have raw content of the image.

aerkalov avatar Jul 23 '17 22:07 aerkalov