mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EreaderReader: dump images function.
This commit is contained in:
parent
f158c9c643
commit
f96cd13f62
@ -202,6 +202,10 @@ class Reader(FormatReader):
|
|||||||
return os.path.join(output_dir, 'metadata.opf')
|
return os.path.join(output_dir, 'metadata.opf')
|
||||||
|
|
||||||
def dump_pml(self):
|
def dump_pml(self):
|
||||||
|
'''
|
||||||
|
This is primarily used for debugging and 3rd party tools to
|
||||||
|
get the plm markup that comprises the text in the file.
|
||||||
|
'''
|
||||||
pml = ''
|
pml = ''
|
||||||
|
|
||||||
for i in range(1, self.header_record.num_text_pages + 1):
|
for i in range(1, self.header_record.num_text_pages + 1):
|
||||||
@ -209,7 +213,21 @@ class Reader(FormatReader):
|
|||||||
|
|
||||||
return pml
|
return pml
|
||||||
|
|
||||||
|
def dump_images(self, output_dir):
|
||||||
|
'''
|
||||||
|
This is primarily used for debugging and 3rd party tools to
|
||||||
|
get the images in the file.
|
||||||
|
'''
|
||||||
|
if not os.path.exists(output_dir):
|
||||||
|
os.makedirs(output_dir)
|
||||||
|
|
||||||
|
with CurrentDir(output_dir):
|
||||||
|
for i in range(0, self.header_record.num_image_pages):
|
||||||
|
name, img = self.get_image(self.header_record.image_data_offset + i)
|
||||||
|
with open(name, 'wb') as imgf:
|
||||||
|
imgf.write(img)
|
||||||
|
|
||||||
|
|
||||||
class EreaderMetadata(object):
|
class EreaderMetadata(object):
|
||||||
|
|
||||||
def __init__(self, record):
|
def __init__(self, record):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user