Skip to main content

Compress EPUB files

Project description

EPUB Crush

PyPI version Test

Compresses EPUB files to reduce size.

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

Installation

This package is available via PyPI and can be installed from there.

pip install epubcrush

Performance

File Original txt txtz Images q=100 Images q=50 No Images
1 589kB 27kB 12kB 584kB (99%) 257kB (44%) 27kB ( 5%)
2 589kB 88kB 30kB 584kB (99%) 285kB (48%) 47kB ( 8%)
3 87kB 89kB 34kB 75kB (86%) 49kB (56%) 39kB (45%)

Why?

EPUBs may include features that may not be desirable from a privacy or efficiency standpoint. Publishers may choose to include high-res images, custom fonts, styles, scripts, 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 use 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. EPUBs are also compressed, so they will often be smaller than simple 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-2.0.3.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

epubcrush-2.0.3-py3-none-any.whl (5.0 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