Skip to main content

A GUI tool to apply perspective transformations to images.

Project description

Image Perspective Transformer

PyPI License Python Version

App Icon

This project provides a PySide6 GUI for marking four points on an image, applying a perspective transform, and exporting a clean crop for documents (e.g., LaTeX). It supports interactive point editing, live preview, and automatic downscaling to a maximum side length for consistent output sizes.

App Demo


Features

  • Smart image view: Fit-to-screen display with accurate coordinate mapping.
  • Fast point selection: Click up to four points to define the transform region.
  • Editable points: Drag points to refine corners; lines and area shading update live.
  • Area highlight: The selected quadrilateral is shaded for clear visual feedback.
  • Detail magnifier: Hold Ctrl near a point for a 2x zoom lens on the corner.
  • Preview + export: Preview the transformed image and save to a chosen path.
  • Max-side downscale: Cap output size via --max-side (default 1024) for LaTeX-friendly images.
  • Shortcuts: Ctrl+Q to quit, Ctrl+S to save, Ctrl+P to preview, Ctrl+Enter to apply.

Ensure the following are installed on your system:

  • Python 3.8+

Install Steps

  1. Install from PyPI:
pip install perspective-transformer
  1. Run the application:
perspective-transformer <image_path> [output_path] [--max-side 1024]

How to Use

  1. Run the Application:

    • Replace image.jpg in the code with the path to your image or place your image in the same directory as the script.

    • Start the application:

      perspective-transformer <image_path> [output_path] [--max-side 1024]
      
  2. Mark Points:

    Click on the image to select four points in any order. These points define the region for perspective transformation. Drag any point to adjust.

  3. Confirm Points:

    After selecting four points, click "Select Points" (or Ctrl+Enter) to apply the transformation.

  4. Preview Transformed Image:

    Click "Preview Transformed Image" to see the transformed result in the same window. If the result is unsatisfactory, click "Clear Points" to reset and reselect points.

  5. Save Transformed Image:

    When satisfied, click "Write Transformed Image" (or Ctrl+S) to save the output as transformed_image.jpg or the specified output path.


License

This project is open-source and can be modified and used for personal or educational purposes. Attribution to the original creator is appreciated. (MIT License)

Enjoy transforming your images! 🚀

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

perspective_transformer-1.1.0.tar.gz (156.3 kB view details)

Uploaded Source

File details

Details for the file perspective_transformer-1.1.0.tar.gz.

File metadata

  • Download URL: perspective_transformer-1.1.0.tar.gz
  • Upload date:
  • Size: 156.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for perspective_transformer-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c888c3d17a98f2782cc298594c9c4a3db378b354177b8fadbf0631dcd54baeee
MD5 744ac939099ef506d661367893250c57
BLAKE2b-256 e14e72d118b4cd87ccff8ef257529c2ce6f2cbd980cec1d3b643c9ee79d9f090

See more details on using hashes here.

Provenance

The following attestation bundles were made for perspective_transformer-1.1.0.tar.gz:

Publisher: publish-to-pypi.yml on zangjiucheng/Perspective-Transformer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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