Skip to content

Feature Request: Native support for standalone images (PNG, JPG, etc.) via MuPDF #128

@HoseaD

Description

@HoseaD

Is your feature request related to a problem?
Currently, Bookokrat cannot open standalone image files.
However, it is highly useful to leverage Bookokrat's high-performance terminal rendering and file-watching capabilities as a live-viewer for diagramming tools (like PlantUML) or other workflows that output to flat image formats.

Describe the solution you'd like
Since the mupdf backend already natively supports rendering single-page image formats out of the box, we can add these extensions to the detect_format and discover_book_in_dir functions.

I have tested this locally, and MuPDF handles terminal image rendering flawlessly without any new rendering logic required.

Architectural Discussion
I would like to submit a PR for this, but I wanted to check if this aligns with the project's goals first, and if so, how you would prefer it modeled internally:

  • Approach A (Minimal Code): Route the image extensions directly to the existing PDF pipeline since MuPDF handles both exactly the same way internally.
"pdf" | "png" | "jpg" | "jpeg" | "gif" | "bmp | "tif" | "tiff" => Some(BookFormat::Pdf),
  • Approach B (Semantic Cleanliness): Create a new BookFormat::Image variant. This would be semantically cleaner but would require adding match arms across the codebase wherever BookFormat::Pdf currently hands off to the MuPDF worker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions