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 11kB 583kB (99%) 256kB (43%) 26kB ( 4%)
2 589kB 91kB 31kB 583kB (99%) 284kB (48%) 46kB ( 8%)
3 87kB 89kB 34kB 76kB (87%) 50kB (57%) 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
      • img
      • picture
      • audio
      • video
      • script
  • Parse opf file removing references to files that no longer exist
  • Remove print page lists

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-5.0.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epubcrush-5.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file epubcrush-5.0.0.tar.gz.

File metadata

  • Download URL: epubcrush-5.0.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for epubcrush-5.0.0.tar.gz
Algorithm Hash digest
SHA256 ed5416c49b6974f5d24fb497973e165751a034863ef86c9be0df9653c370d822
MD5 d0c783952d88f2ec6e97e664ec698a85
BLAKE2b-256 85204c781a5f979d1b3e24a1edfc6ce9c58465eb1b80f470008971f8efdd39ac

See more details on using hashes here.

File details

Details for the file epubcrush-5.0.0-py3-none-any.whl.

File metadata

  • Download URL: epubcrush-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for epubcrush-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 656b2cea63d474c91331efe26fa2f48fa75ac8244eb1f83de9e13cbfd0cd533f
MD5 452d8810dad9dcd135e1beda6519b065
BLAKE2b-256 19ef581375a34c38eefa4dfb314bdfbaaf4182489c2c936708fa3a5a48046236

See more details on using hashes here.

Supported by

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