File image re-compression tool - supports ZIP, RAR, EPUB format image compression processing
Project description
ezipress - File Image Re-compression Tool
A file image re-compression tool that supports ZIP, RAR, and EPUB format image compression processing.
Features
- Multi-format Support: Supports ZIP, RAR, and EPUB file formats
- Smart Compression: Automatically detects and compresses image files
- Quality Control: Configurable JPEG/WEBP quality parameters
- Batch Processing: Supports batch processing of large numbers of files
- Compression Markers: Adds compression markers to processed EPUB files to avoid reprocessing
- Backup Mechanism: Automatically creates backups and can restore on processing failure
Installation
System Requirements
- Python 3.8+
- Linux/macOS/Windows
Installation Steps
# Install from PyPI
pip install ezipress
# Or install from source
git clone https://github.com/eyes1971/ezipress.git
cd ezipress
pip install -e .
Optional Dependencies
# Install RAR support
pip install ezipress[rar]
# Install full functionality (includes all optional dependencies)
pip install ezipress[full]
# Install development dependencies
pip install ezipress[dev]
Usage
Basic Usage
# Compress a single file
ezipress file.zip
# Compress multiple files
ezipress file1.zip file2.epub file3.rar
# Process all supported files in a directory
ezipress /path/to/directory/
# Recursively process subdirectories
ezipress -r /path/to/directory/
Advanced Options
# Set target file size (KB)
ezipress -t 1024000 file.zip
# Set JPEG quality (1-100)
ezipress -q 85 file.zip
# Set PNG to JPG threshold (KB)
ezipress -p 300 file.zip
# Enable debug mode
ezipress --debug file.zip
Command Line Parameters
| Parameter | Description | Default |
|---|---|---|
-t, --target-size |
Target file size (KB) | - |
-m, --min-size |
Skip images smaller than this size (KB) | 240 |
-q, --quality |
JPEG/WEBP quality reference value (1-100) | 95 |
-p, --png-to-jpg-threshold |
PNG to JPG threshold (KB) | 500 |
--webp-to-jpg-threshold |
WEBP to JPG threshold (KB) | 1024 |
-r, --recursive |
Recursively process subdirectories | No |
-f, --force |
Force recompression of marked EPUB files | No |
-s, --skip-compressed |
Automatically skip compressed EPUB files | No |
--add-marker |
Add compression markers to processed EPUB files | Yes |
--no-backup |
Do not keep backups of original files | No |
--workers |
Number of parallel worker processes | CPU cores |
--debug |
Enable debug mode | No |
Project Structure
src/
├── cli.py # Command line interface
├── main.py # Main program logic
├── config.py # Configuration management
├── typing.py # Type definitions
├── archive/ # File format handlers
│ ├── epub_handler.py # EPUB handler
│ ├── zip_handler.py # ZIP handler
│ ├── rar_handler.py # RAR handler
│ └── marker.py # Compression marker management
├── compressor/ # Image compression core
│ ├── core.py # Compression core logic
│ ├── strategy.py # Compression strategy
│ └── exceptions.py # Custom exceptions
├── controller/ # Processing controllers
│ └── batch_controller.py # Batch processing controller
├── display/ # Display interface
│ └── legacy_output.py # Traditional text output
└── utils/ # Utility functions
├── logger.py # Logging management
└── file_utils.py # File utilities
Development
Setting up Development Environment
# Install development dependencies
pip install -e .[dev]
# Run tests
pytest
# Format code
black src/
isort src/
# Check code
flake8 src/
mypy src/
Building Release Version
# Build release version
python -m build
# Upload to PyPI
twine upload dist/*
License
This project is licensed under the MIT License.
Contributing
Issues and Pull Requests are welcome!
Contact Information
- Author: Sam Weng
- Email: eyes1971@gmail.com
- Project Homepage: https://github.com/eyes1971/ezipress
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ezipress-202601210707.tar.gz
(27.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ezipress-202601210707.tar.gz.
File metadata
- Download URL: ezipress-202601210707.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38d3b219abb91352b87c290fc7309156d37e33bf894ecd72c13a2d815956659e
|
|
| MD5 |
ae0731fa70f14e3bb9e2dab2befba9e5
|
|
| BLAKE2b-256 |
36cd36a3a385511ccdc63ca0866da7e5a7eb4fd90f99ca28a49ff9794378aac8
|
File details
Details for the file ezipress-202601210707-py3-none-any.whl.
File metadata
- Download URL: ezipress-202601210707-py3-none-any.whl
- Upload date:
- Size: 36.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df9a39cf7f3cfaf44e9637e78de8560558018c141ade894e36f338f58770ff38
|
|
| MD5 |
96d07fa4ab1a7bd8e66ee51ed47c8e78
|
|
| BLAKE2b-256 |
5b4ee1d35bafc723d76b1e604834fb496566e22291c1bf80dd533014ff627cce
|