Skip to main content

Default template for PDM package

Project description

Buy Me A Coffee

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/cruzancaramele/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:
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.1.tar.gz (12.9 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.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file picfix-0.1.1.tar.gz.

File metadata

  • Download URL: picfix-0.1.1.tar.gz
  • Upload date:
  • Size: 12.9 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.1.tar.gz
Algorithm Hash digest
SHA256 e7758c3bb3e467bbabf85e26f554adfc866756aaae65190593467d51e5f3f638
MD5 cd823c666a1ee3ce58eab818cfaff27f
BLAKE2b-256 fe4a11d5425908550868d3905ece955bbd5f60e9acf439ef639e68f7b8d4e843

See more details on using hashes here.

File details

Details for the file picfix-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: picfix-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38776e3790725fc9588cf75ac44e4cbcaa6d37279e96a87d4e83bdd5f2aa807e
MD5 dfb0cced82d3af9a66b52da4ec0d1c1a
BLAKE2b-256 410ad6bcf58caa5c45cf4ceb2c96815cba68ff61d1827cf9a8ca6f21b67c1ab7

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