A Python package to convert PNG images to JPG format while maintaining directory structure
Project description
png2jpg
A Python package to convert PNG images to JPG format while maintaining directory structure and optimizing file sizes.
Installation
You can install the package using pip:
pip install png2jpg
Usage
The package provides a command-line interface to convert PNG images to JPG format. Here's how to use it:
Basic Usage
png2jpg -d /path/to/png/directory -o /path/to/output/directory
Alternative Usage
You can also run the package as a Python module:
python -m png2jpg -d /path/to/png/directory -o /path/to/output/directory
Command Line Arguments
-d, --directory: (Required) The root directory containing PNG files to convert-o, --output: (Optional) The output directory for JPG files (default: 'lower')-q, --quality: (Optional) JPG quality (0-100, default: 50)-l, --lowest: (Optional) Minimum file size in MB to apply quality reduction (default: 0.5)-v, --verbose: (Optional) Enable verbose output
Examples
- Convert all PNG files in a directory with default settings:
png2jpg -d ./images
- Convert with custom quality and minimum file size:
png2jpg -d ./images -q 80 -l 1.0
- Convert with verbose output:
png2jpg -d ./images -v
- Convert with custom output directory:
png2jpg -d ./images -o ./converted_images
Features
- Maintains original directory structure
- Automatically creates output directories
- Preserves full quality for small files (below the minimum size threshold)
- Configurable JPG quality
- Verbose mode for detailed conversion information
Requirements
- Python 3.8+
- Pillow (PIL Fork) >= 8.0.0
License
MIT License
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
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 png2jpg-0.1.0.tar.gz.
File metadata
- Download URL: png2jpg-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8c33c45f7ec26b4257b8534bc329ab6f077d44929292891d2357a2cb8ff206f
|
|
| MD5 |
950ff1bf5ac2f99cba8584bb7dd0eb2b
|
|
| BLAKE2b-256 |
897b564b30dcb1d765bac76a7ea572757b18ab20f81484cf52f30c8ce8c41245
|
File details
Details for the file png2jpg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: png2jpg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ade4f5eecced037e19ab8a60e5ddb01706d84a4415271afd2d674cc7003341b
|
|
| MD5 |
bb0a5f82c2d92e1c2f0bb34f5be31556
|
|
| BLAKE2b-256 |
5bbe1c70cccd647bc56b52c89e5830e6daf49fb62036ed60e75107593c9e9a28
|