Skip to content

This is a simple PyQt6 application to calculate and visualize aspect ratios.

Notifications You must be signed in to change notification settings

aroslanov/Image-Aspect-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Image Aspect Ratio Calculator

This is a simple PyQt6 application to calculate and visualize aspect ratios. It allows you to input dimensions, select common aspect ratios, and drag-and-drop images to auto-fill dimensions. This project was inspired by Andrew Hedges' Aspect Ratio Calculator.

Features

  • Input custom dimensions to calculate aspect ratios.
  • Select from a list of common aspect ratios.
  • Drag and drop images to auto-fill dimensions.
  • Option to round results to the nearest whole number.
  • Visualize the aspect ratio result.

Installation

Using requirements.txt

  1. Clone the repository:
    git clone https://github.com/yourusername/aspect-ratio-calculator.git
  2. Navigate to the project directory:
    cd aspect-ratio-calculator
  3. Install the required dependencies:
    pip install -r requirements.txt

Without requirements.txt

  1. Clone the repository:
    git clone https://github.com/yourusername/aspect-ratio-calculator.git
  2. Navigate to the project directory:
    cd aspect-ratio-calculator
  3. Install the dependencies individually:
    pip install PyQt6 Pillow

Usage

Run the application using the following command:

python aspect_ratio_calculator.py

Dependencies

  • Python 3.x
  • PyQt6
  • Pillow

How to Use

  1. Input Dimensions:

    • Enter the width (W1) and height (H1) to calculate their aspect ratio.
    • Optionally, enter the width (W2) or height (H2) to calculate the missing dimension based on the aspect ratio of W1 and H1.
  2. Select Common Ratios:

    • Use the dropdown to select a common aspect ratio. This will auto-fill W1 and H1 with the selected ratio.
  3. Drag and Drop Images:

    • Drag an image file into the designated area to auto-fill W1 and H1 with the image's dimensions.
    • A thumbnail of the image will be displayed.
  4. Rounding Option:

    • Check the "Round results to the nearest whole number" checkbox if you prefer rounded results.
  5. Calculate Button:

    • Click the "Calculate" button to compute the aspect ratio based on the provided dimensions.

Example

  1. Enter 1920 for W1 and 1080 for H1.
  2. Click "Calculate" to see the aspect ratio 16:9.
  3. Optionally, enter a value for W2 or H2 to compute the missing dimension based on the aspect ratio.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License.

Acknowledgements

This project was inspired by Andrew Hedges' Aspect Ratio Calculator. Thank you for providing the original idea and calculations.

About

This is a simple PyQt6 application to calculate and visualize aspect ratios.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages