Skip to main content

A lightweight Python package that converts images in a directory from one format to another while preserving their dimensions.

Project description

Image Format Converter

A lightweight Python package that converts images in a directory from one format to another while preserving their dimensions.

Features:

  • Convert images from one format (e.g., JPEG) to another (e.g., PNG).
  • Option to save the converted images in a different directory.
  • Option for recursive conversion in subdirectories.
  • Option to overwrite the original images with the converted ones.

Installation

To install the Image Format Converter, use pip:

pip install image-format-converter

Usage

After installing the package, you can use it from the command line:

image-format-converter -d DIRECTORY -i INPUT_FORMAT -o OUTPUT_FORMAT [OPTIONS]

Parameters

-d, --directory: Path of the directory containing images to be converted.
-i, --input_format: Input image format (e.g., jpeg, png).
-o, --output_format: Output image format (e.g., png, bmp).
-od, --output_directory: Directory to save the converted images. If not specified, images will be saved in the input directory.
-r, --recursive: Use this flag to process files in subdirectories too.
--overwrite: Use this flag to overwrite the original image with the converted one.

Examples

Basic Conversion:

Convert all JPEG images in the images/ directory to PNG.

image-format-converter -d images/ -i jpeg -o png

Saving to a Different Directory:

Convert all JPEG images in the images/ directory to PNG and save them in converted/ directory.

image-format-converter -d images/ -i jpeg -o png -od converted/

Recursive Conversion:

Convert all JPEG images in the images/ directory and its subdirectories to PNG.

image-format-converter -d images/ -i jpeg -o png -r

Overwriting Original Images:

Convert all JPEG images in the images/ directory to PNG and replace the original JPEGs.

image-format-converter -d images/ -i jpeg -o png --overwrite

License

This project is open-source and available 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

image_format_converter-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

image_format_converter-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: image_format_converter-0.1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for image_format_converter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3825a8b5e6e87e653e3c51afc944fc981f4bb536ac5eb06eed00cfaf3aa742aa
MD5 165a5408fbc2df6f0a091c6c4618d5ae
BLAKE2b-256 35318354c8f49677fc610fb323360d312302887842c48258d8a2e50e5cc5d939

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for image_format_converter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a920a194ddc61f674e6bdfe7d450f61222db725cacf1c874d5fc3c3108649e0e
MD5 09d113d46fc4675601f8efe942508833
BLAKE2b-256 63d32644208174aa2511ff2bed3dfb165425171969daf93b2350a975d025f10c

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