Skip to main content

Compress EPUB files

Project description

EPUB Crush

Removes media content and compresses EPUB files to reduce size.

By default, all images, fonts, scipts, and styles will be removed from the EPUB.

Why?

EPUB is a fine format, but it includes many features that may not be desirable from a privacy or efficiency standpoint. This includes full JavaScript support (did you know that you can use WebGL inside an eBook?). Publishers often choose to include high-res images, custom fonts, styles, and other features that bloat the size of EPUBs beyond what is needed for the text content of a book. This application strips away everything but the plain text content.

Why not just plain text?

EPUB adds a number of useful reading features (table of contents, metadata, etc) that are useful and not available in basic plain text.

Method of Operation

  • Iterate files in container
  • Remove all files that are not part of the document text or part of the EPUB structure
  • Parse XML files
    • Remove the following tags
      • link
      • meta
      • style
      • picture
      • audio
      • video
      • script
    • Replace img tags with their alt text in a p tag

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epubcrush-1.0.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

epubcrush-1.0.0-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page