Bilder standardmäßig als JPEG (--image-format), Output/ ignorieren

EPUB Band 1: 12,9 MB -> 5,0 MB, Band 2: 14,3 MB -> 5,3 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-10-02 00:47:42 +02:00
commit eb8eea9991

View file

@ -805,7 +805,7 @@ def convert_pages(source: str, run: str, pages: list[int], options: dict) -> str
footer=options["keep_footers"],
write_images=options["images"],
image_path=options["image_path"],
image_format="png",
image_format=options["image_format"],
)
if run == RUN_OCR:
kwargs.update(
@ -984,6 +984,12 @@ def main() -> int:
action="store_true",
help="Grafiken speichern und in Markdown verlinken",
)
parser.add_argument(
"--image-format",
choices=["jpg", "png"],
default="jpg",
help="Bildformat: jpg (klein, Standard) oder png (verlustfrei, groß)",
)
parser.add_argument(
"--epub",
action="store_true",
@ -1057,7 +1063,7 @@ def main() -> int:
if args.images:
image_dir.mkdir(parents=True, exist_ok=True)
if epub_path:
cover = image_dir / "cover.png"
cover = image_dir / f"cover.{args.image_format}"
doc[0].get_pixmap(dpi=150).save(cover)
options = dict(
@ -1065,6 +1071,7 @@ def main() -> int:
keep_footers=args.keep_footers,
images=args.images,
image_path=str(image_dir.resolve()) if args.images else "",
image_format=args.image_format,
ocr_language=args.ocr_language,
ocr_dpi=args.ocr_dpi,
)