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

@ -110,7 +110,9 @@ def test_epub(pdfs, tmp_path):
out = tmp_path / "buch.md"
run(pdfs["digital"], out, "--epub")
epub = tmp_path / "buch.epub"
assert (tmp_path / "buch_images" / "cover.png").is_file()
images = tmp_path / "buch_images"
assert (images / "cover.jpg").is_file()
assert {f.suffix for f in images.iterdir()} == {".jpg"}
with zipfile.ZipFile(epub) as z:
assert z.read("mimetype") == b"application/epub+zip"
nav = z.read("EPUB/nav.xhtml").decode()
@ -119,3 +121,10 @@ def test_epub(pdfs, tmp_path):
assert title in nav
assert "Erika Muster" in opf
assert "cover" in opf
def test_png_on_request(pdfs, tmp_path):
out = tmp_path / "png.md"
run(pdfs["digital"], out, "--images", "--image-format", "png")
md = out.read_text(encoding="utf-8")
assert re.search(r"!\[\]\(png_images/[^)]+\.png\)", md)