Image Perspective Transformer
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.
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
- Install from PyPI:
pip install perspective-transformer
- Run the application:
perspective-transformer <image_path> [output_path] [--max-side 1024]
How to Use
-
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]
-
-
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.
-
Confirm Points:
After selecting four points, click "Select Points" (or Ctrl+Enter) to apply the transformation.
-
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.
-
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! 🚀
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c888c3d17a98f2782cc298594c9c4a3db378b354177b8fadbf0631dcd54baeee
|
|
| MD5 |
744ac939099ef506d661367893250c57
|
|
| BLAKE2b-256 |
e14e72d118b4cd87ccff8ef257529c2ce6f2cbd980cec1d3b643c9ee79d9f090
|
Provenance
The following attestation bundles were made for perspective_transformer-1.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on zangjiucheng/Perspective-Transformer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
perspective_transformer-1.1.0.tar.gz -
Subject digest:
c888c3d17a98f2782cc298594c9c4a3db378b354177b8fadbf0631dcd54baeee - Sigstore transparency entry: 946411019
- Sigstore integration time:
-
Permalink:
zangjiucheng/Perspective-Transformer@3c46309b223d10aab3c76c2c70074ef9faa1a279 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/zangjiucheng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3c46309b223d10aab3c76c2c70074ef9faa1a279 -
Trigger Event:
push
-
Statement type: