Skip to content

A convenient tool for converting between JPEG, WebP, PNG, GIF, BMP, and TIFF formats. Also supports resizing.

License

Notifications You must be signed in to change notification settings

vorlie/ImageConverter

Repository files navigation

Image Converter

Overview

This project provides two applications for converting and resizing images:

  1. ImageConverter.exe: A graphical user interface (GUI) application built with PyQt5.
  2. ImageConverterCLI.exe: A command-line interface (CLI) tool for batch processing images.

Both tools allow users to convert images between different formats and optionally resize them.

Project Structure

The project directory contains:

  • module/: Directory containing the image processing logic.
  • cli.py: Source code for the CLI tool.
  • gui.py: Source code for the GUI application.
  • requirements.txt: List of Python dependencies.
  • LICENSE: License information.
  • README.md: This file.
  • .gitignore: Git ignore rules.
  • ImageConverter.spec: PyInstaller spec file for the GUI application.
  • ImageConverterCLI.spec: PyInstaller spec file for the CLI tool.

Downloading the Executables

The compiled executables for Windows are not included in the repository. Instead, you can download them from the GitHub Releases page:

ImageConverter.exe (GUI)

Features

  • Select Image File: Choose an image file from your filesystem.
  • Convert Image Format: Convert the selected image to one of the supported formats (JPEG, WebP, PNG, GIF, TIFF, BMP).
  • Resize Options: Optionally resize the image before conversion.
  • Image Preview: View a preview of the selected image.
  • Convert Button: Execute the conversion process.

Running the GUI Application

  1. Download the zip file from the GitHub Releases page.
  2. Extract the zip file.
  3. Run the GUI Application by double-clicking the ImageConverter.exe file.

Missing Icon

If the icon is missing from the GUI application, download the icon from the GitHub repository and place it under the ./_internal/ directory (that directory should be in the same directory as the executable). It should be named icon.ico.

ImageConverterCLI.exe (CLI)

Features

  • Convert Image Format: Convert images to various formats from the command line.
  • Resize Options: Resize images during conversion.

Running the CLI Tool

  1. Download the executable from the GitHub Releases page.

  2. Run the CLI Tool from the command line:

    ./ImageConverterCLI.exe <input_file> <output_format> [--max-width WIDTH] [--max-height HEIGHT]
    • <input_file>: Path to the input image file.
    • <output_format>: Desired output format (jpeg, webp, png, gif, tiff, bmp).
    • --max-width: Optional maximum width for resizing.
    • --max-height: Optional maximum height for resizing.

    Example:

    ./ImageConverterCLI.exe myphoto.png jpeg --max-width 800 --max-height 600

Development

To contribute to the development or modify the applications:

  1. Clone the Repository:

    git clone <repository-url>
  2. Navigate to the Project Directory:

    cd <project-directory>
  3. Install Dependencies:

    pip install -r requirements.txt --ignore-requires-python
  4. Run the Applications:

    • GUI Application:

      python gui.py
    • CLI Tool:

      python cli.py
  5. Build the Executables:

    Use PyInstaller to bundle the applications into standalone executables.

    If you do not have PyInstaller installed:

    pip install pyinstaller==6.6.0
    • For GUI Application:

      pyinstaller ImageConverter.spec
    • For CLI Tool:

      pyinstaller ImageConverterCLI.spec
  6. Test the Executables:

    The built executables will be located in the dist/ directory. Test them to ensure they work as expected.

Thanks

A special thanks to the following projects that made this tool possible:

  • Pillow: A powerful Python Imaging Library used for opening, manipulating, and saving image files. Version 10.2.0.
  • PyQt5: A set of Python bindings for Qt libraries used for creating graphical user interfaces. Version 5.15.10.
  • PyQtDarkTheme: A library for applying dark themes to PyQt5 applications. Version 2.1.0.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A convenient tool for converting between JPEG, WebP, PNG, GIF, BMP, and TIFF formats. Also supports resizing.

Resources

License

Stars

Watchers

Forks

Languages