Skip to main content

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:

  1. Clone the repository:
git clone https://github.com/yourusername/picfix.git
cd picfix
  1. 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:

  1. Install PDM if you haven't already:

Development

PicFix uses PDM for dependency management. To set up the development environment:

  1. Install PDM if you haven't already:
pdm install
  1. Install development dependencies:
pdm install -d
  1. Run tests:
pdm run pytest

Project Structure

  • src/picfix/: Main package
  • commands/: Command implementations
  • img_processors/: Image processing logic
  • models/: Data models for commands
  • tests/: 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

picfix-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

picfix-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

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

Hashes for picfix-0.1.0.tar.gz
Algorithm Hash digest
SHA256 00e368c22c054040ef180b7a8d94dbf7a1b8a50d15a47d79acc1ec1206c54875
MD5 ede68be4a9e93f8afead43c48951a79f
BLAKE2b-256 7c9f059b78952082d32895812fc7f75ea82410b7cc1dfddba5b0d3bad9742812

See more details on using hashes here.

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

Hashes for picfix-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f752a1664108ac80c565be04b1332758c6367f403ab3dd58a7b86f3f6d242cdc
MD5 bb5afff9ef1defa540b3019c53f02573
BLAKE2b-256 325a834a73773c496f85b8825325760d2b991b641d929dc0e5d20f051b1ae011

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