|
| 1 | +PyQt Image Editor |
| 2 | + |
| 3 | +Overview |
| 4 | + |
| 5 | +The PyQt Image Editor is a demo application built using PyQt5 and Python. It showcases a modular approach to image editing by integrating a wide range of features including basic file operations, cropping, resizing, rotation, flipping, color adjustments, filters, freehand drawing with adjustable brush color and size, undo/redo functionality, zooming/panning, and histogram analysis. This project serves as a starting point for further development of more complex image editing tools. |
| 6 | + |
| 7 | +Features |
| 8 | + • Open and Save Images: |
| 9 | +Load images from and save images to various formats (PNG, JPG, JPEG, BMP, GIF). |
| 10 | + • Cropping Tool: |
| 11 | +Select a rectangular area on the image to crop. |
| 12 | + • Resizing and Scaling: |
| 13 | +Dynamically resize images to specified dimensions. |
| 14 | + • Advanced Rotation: |
| 15 | +Rotate images by an arbitrary angle (not just fixed 90° increments). |
| 16 | + • Flip/Mirror Functions: |
| 17 | +Flip images horizontally or vertically. |
| 18 | + • Color Adjustments: |
| 19 | +Adjust brightness, contrast, and saturation using slider controls. |
| 20 | + • Image Filters and Effects: |
| 21 | +Apply filters such as Grayscale, Sepia, Blur, Sharpen, and Edge Detection. |
| 22 | + • Drawing and Annotation Tools: |
| 23 | +Freehand drawing on images with options to choose the brush color and adjust the brush size. |
| 24 | + • Undo/Redo Functionality: |
| 25 | +Maintain a history of editing actions so users can easily undo or redo changes. |
| 26 | + • Zoom and Pan: |
| 27 | +Zoom in and out of the image and pan across large images. |
| 28 | + • Histogram and Color Analysis: |
| 29 | +Display the image’s color histogram for red, green, and blue channels. |
| 30 | + • Layer Support (Stub): |
| 31 | +A placeholder for future implementation of layer support. |
| 32 | + |
| 33 | +Requirements |
| 34 | + • Python 3.x |
| 35 | + • PyQt5 |
| 36 | + • Pillow |
| 37 | + • matplotlib |
| 38 | + |
| 39 | +Installation |
| 40 | + 1. Clone or Download the Repository: |
| 41 | +Save the image_editor.py file to your local machine. |
| 42 | + 2. Install Dependencies: |
| 43 | +Open your terminal or command prompt and run: |
| 44 | + |
| 45 | +pip install PyQt5 Pillow matplotlib |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +Running the Application |
| 50 | + |
| 51 | +To run the image editor demo, execute the following command in the directory where image_editor.py is located: |
| 52 | + |
| 53 | +python image_editor.py |
| 54 | + |
| 55 | +Packaging as a Standalone Application |
| 56 | + |
| 57 | +You can package this application into a standalone executable using PyInstaller: |
| 58 | + 1. Install PyInstaller: |
| 59 | + |
| 60 | +pip install pyinstaller |
| 61 | + 2. Create the Executable: |
| 62 | +Navigate to the directory containing image_editor.py and run: |
| 63 | + |
| 64 | +pyinstaller --onefile --windowed image_editor.py |
| 65 | + • The --onefile flag bundles the app into a single executable. |
| 66 | + • The --windowed flag prevents a terminal window from appearing when the app is run. |
| 67 | + 3. Locate Your Executable: |
| 68 | +After the process completes, check the dist folder for your standalone application: |
| 69 | + • On Windows: You will find image_editor.exe. |
| 70 | + • On macOS/Linux: The executable will be available and can be further customized into an app bundle if desired. |
| 71 | + |
| 72 | +Usage Instructions |
| 73 | + • File Operations: |
| 74 | +Use the toolbar buttons to open and save images. |
| 75 | + • Editing Tools: |
| 76 | + • Click Crop to select and crop a portion of the image. |
| 77 | + • Use Resize to change image dimensions. |
| 78 | + • Select Rotate… to rotate the image by a custom angle. |
| 79 | + • Flip H/V to flip the image horizontally or vertically. |
| 80 | + • Use Adjust Colors to modify brightness, contrast, and saturation. |
| 81 | + • Filters: |
| 82 | +Click the Filters button to choose from Grayscale, Sepia, Blur, Sharpen, or Edge Detection filters. |
| 83 | + • Drawing and Annotations: |
| 84 | +Toggle Draw mode to start freehand drawing. |
| 85 | + • Use Brush Color to choose a custom drawing color. |
| 86 | + • Use Brush Size to adjust the thickness of the drawing brush. |
| 87 | + • Undo/Redo: |
| 88 | +Revert changes using the Undo and Redo buttons. |
| 89 | + • Zoom and Pan: |
| 90 | +Use Zoom In and Zoom Out to adjust the view. |
| 91 | + • Histogram: |
| 92 | +Click Histogram to display the color histogram of the current image. |
| 93 | + • Layers: |
| 94 | +A placeholder for future layer support functionality. |
| 95 | + |
| 96 | +Future Enhancements |
| 97 | + • Comprehensive layer management. |
| 98 | + • Enhanced error handling and user interface improvements. |
| 99 | + • Additional image processing and editing tools. |
0 commit comments