Default template for PDM package
Project description
PicFix
PicFix is a command-line tool for quick and easy image manipulation. It provides simple yet powerful commands to resize, convert, and optimize images.
Features
- Resize images to specified dimensions
- Convert images between different formats
- Optimize images to reduce file size
- Support for multiple input files
- Logging for operation tracking and debugging
Supported Image Formats
PicFix supports a wide range of image formats for both input and output:
- JPEG (.jpg, .jpeg)
- PNG (.png)
- WebP (.webp)
- GIF (.gif)
- BMP (.bmp)
- TIFF (.tiff, .tif)
Note: The actual support may vary depending on your system's Pillow installation. Some formats may be read-only or write-only. Optimization is currently focused on JPEG and PNG formats.
Installation
To install PicFix, follow these steps:
- Clone the repository:
git clone https://github.com/yourusername/picfix.git
cd picfix
- Install dependencies using PDM:
pdm install
Usage
PicFix provides two main commands: resize and convert.
Resize Command
Resize one or more images to specified dimensions:
pdm run picfix resize -i <input_file> -o <output_directory> --width <width> --height <height>
Example:
pdm run picfix resize -i image.jpg -o resized_images --width 800 --height 600
Convert Command
Convert one or more images to a specified format:
pdm run picfix convert -i <input_file> -o <output_directory> --format <format>
Example:
pdm run picfix convert -i image.png -o converted_images --format JPEG
Optimize Command
Optimize one or more images to reduce file size:
pdm run picfix optimize -i <input_file> -o <output_directory> [options]
Options:
-q,--quality: Set the quality for lossy compression (1-100, for JPEG)-t,--target-size: Set a target file size in KB-s,--strip-metadata: Remove metadata from the image
Example:
pdm run picfix optimize -i image.jpg -o optimized_images -q 85 -t 100 -s
This command will optimize image.jpg, aiming for a quality of 85 and a target size of 100KB, while also stripping metadata.
Image Optimization
The optimize command uses different strategies for JPEG and PNG files:
- For JPEG: It adjusts the compression quality to meet the target size or reduce file size by at least 20%.
- For PNG: It uses color quantization, trying different color palette sizes to find the best balance between file size and image quality.
Note: PNG optimization might be limited for images with transparency.
Development
PicFix uses PDM for dependency management. To set up the development environment:
- Install PDM if you haven't already:
Development
PicFix uses PDM for dependency management. To set up the development environment:
- Install PDM if you haven't already:
pdm install
- Install development dependencies:
pdm install -d
- Run tests:
pdm run pytest
Project Structure
src/picfix/: Main packagecommands/: Command implementationsimg_processors/: Image processing logicmodels/: Data models for commandstests/: Test files (to be implemented)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the 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 picfix-0.1.0.tar.gz.
File metadata
- Download URL: picfix-0.1.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.17.1 CPython/3.12.4 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00e368c22c054040ef180b7a8d94dbf7a1b8a50d15a47d79acc1ec1206c54875
|
|
| MD5 |
ede68be4a9e93f8afead43c48951a79f
|
|
| BLAKE2b-256 |
7c9f059b78952082d32895812fc7f75ea82410b7cc1dfddba5b0d3bad9742812
|
File details
Details for the file picfix-0.1.0-py3-none-any.whl.
File metadata
- Download URL: picfix-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.17.1 CPython/3.12.4 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f752a1664108ac80c565be04b1332758c6367f403ab3dd58a7b86f3f6d242cdc
|
|
| MD5 |
bb5afff9ef1defa540b3019c53f02573
|
|
| BLAKE2b-256 |
325a834a73773c496f85b8825325760d2b991b641d929dc0e5d20f051b1ae011
|