pdf-deskew


Namepdf-deskew JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA GUI tool for deskewing scanned PDF documents using PyQt6 and OpenCV
upload_time2025-10-25 16:56:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT
keywords pdf deskew image-processing gui pyqt6 opencv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PDF Deskew Tool

[中文文档](./README_zh.md)

## Overview

PDF Deskew Tool is a graphical user interface (GUI) application designed to correct skewed pages in scanned PDF documents. It leverages PyMuPDF, OpenCV, and other powerful libraries to process each page of a PDF and generate a corrected version with improved readability and visual balance. The tool supports multi-language interfaces, theme switching, file drag-and-drop, and detailed progress feedback, aiming to provide a simple and efficient user experience.

## Features

- **Multi-language Support**: Supports both Chinese and English interfaces with easy language switching.
- **Drag-and-Drop File Selection**: Simply drag and drop your PDF files for easy selection.
- **Batch Processing**: Process multiple PDF files simultaneously to improve work efficiency.
- **Real-time Progress Feedback**: Display progress bars and percentages to track processing status.
- **Theme Switching**: Offers multiple interface themes for personalized appearance.
- **Customizable Settings**:
  - **DPI Configuration**: Customize rendering DPI to meet different quality requirements.
  - **Background Color Selection**: Choose or customize background colors to optimize correction results.
  - **Image Enhancement**: Remove watermarks, enhance contrast, denoise, and sharpen images.
- **Logging**: Records important information and errors during processing for debugging and user feedback.
- **Intuitive Interface**: User-friendly design with icons and tooltips for enhanced usability.

## Installation

### Recommended: Using uv

```bash
uv tool install pdf-deskew
```

This will automatically create two executable commands: `pdf-deskew` (GUI) and `pdf-deskew-cli` (CLI).

### Alternative: Using pip

```bash
pip install pdf-deskew
```

### From Source (Development)

```bash
git clone https://github.com/tinnci/pdf_deskew.git
cd pdf_deskew

# Create virtual environment
uv venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install in development mode
uv pip install -e .
```

## Dependencies

The tool automatically installs the following dependencies:

- **PyQt6** (>=6.7.1): GUI framework
- **PyMuPDF** (>=1.24.13): PDF processing
- **OpenCV** (>=4.10.0.84): Image processing
- **Pillow** (>=11.0.0): Image manipulation
- **numpy** (>=2.1.2): Numerical computing
- **deskew** (>=1.5.1): Skew detection
- **qt-material** (>=2.14): Theme support
- **tqdm** (>=4.66.6): Progress bars

## Usage

### GUI Application

Start the application:

```bash
pdf-deskew
```

**Interface Guide**:

1. **File Selection**:
   - **Input PDF**: Click "Browse" button or drag-and-drop a PDF file
   - **Output PDF**: Specify save location (default: `input_filename_deskewed.pdf`)

2. **Processing Options**:
   - **Use Recommended Settings**: DPI=300, white background
   - **Custom Settings**: Adjust DPI, background color, watermark removal, image enhancement
   - **Image Processing**:
     - Remove watermarks (Inpainting)
     - Enhance images (contrast, denoising, sharpening)
     - Convert to grayscale

3. **Language & Theme**:
   - Switch between English and Chinese
   - Choose from multiple interface themes

### Command-Line Tool

View help:

```bash
pdf-deskew-cli --help
```

Basic usage:

```bash
# Simple conversion
pdf-deskew-cli input.pdf

# Specify output
pdf-deskew-cli input.pdf -o output.pdf

# Custom DPI
pdf-deskew-cli input.pdf -d 600

# With enhancements
pdf-deskew-cli input.pdf --enhance --remove-watermark

# Change background
pdf-deskew-cli input.pdf --bg-color black
```

**Command-line Arguments**:
- `input`: Input PDF file path (required)
- `-o, --output`: Output file path (default: `input_deskewed.pdf`)
- `-d, --dpi`: Rendering DPI, range 72-1200 (default: 300)
- `--bg-color`: Background color, white or black (default: white)
- `--enhance`: Enable image enhancement
- `--remove-watermark`: Enable watermark removal
- `-v, --version`: Show version number

## System Requirements

- **Operating System**: Windows, macOS, or Linux
- **Python**: 3.12 or higher
- **Optional**: [uv package manager](https://docs.astral.sh/uv/) (recommended)

## Notes

- **Special Characters in Paths**: If your file paths contain spaces or special characters, use quotes to avoid errors.
- **Temporary Files**: The application creates a temporary folder for intermediate images, which is automatically cleaned up after processing.
- **Logging**: Processing logs are recorded in `pdf_deskew.log` for debugging purposes.
- **Theme Switching**: Theme changes take effect immediately without requiring application restart.

## Development

To contribute to this project:

1. **Clone the Repository**:
   ```bash
   git clone https://github.com/tinnci/pdf_deskew.git
   cd pdf_deskew
   ```

2. **Set Up Environment**:
   ```bash
   uv venv .venv
   source .venv/bin/activate  # On Windows: .venv\Scripts\activate
   uv pip install -e .
   ```

3. **Run Tests**:
   ```bash
   pytest
   ```

4. **Submit Changes**:
   ```bash
   git add .
   git commit -m "Description of changes"
   git push origin your-branch
   ```

## License

This project is licensed under the MIT License. You are free to use and modify it.

## Support

For issues or questions:
- GitHub Issues: https://github.com/tinnci/pdf_deskew/issues
- Email: luoyido@outlook.com

---

Thank you for using PDF Deskew Tool! If you find it useful, please give us a ⭐ on GitHub and share it with others who might benefit.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pdf-deskew",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "pdf, deskew, image-processing, gui, pyqt6, opencv",
    "author": null,
    "author_email": "driezy <luoyido@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/7a/59/58c542669ca4c0c5470c604eff97ec56ef61aa3b9260a63fdef8e36069bf/pdf_deskew-0.1.2.tar.gz",
    "platform": null,
    "description": "# PDF Deskew Tool\n\n[\u4e2d\u6587\u6587\u6863](./README_zh.md)\n\n## Overview\n\nPDF Deskew Tool is a graphical user interface (GUI) application designed to correct skewed pages in scanned PDF documents. It leverages PyMuPDF, OpenCV, and other powerful libraries to process each page of a PDF and generate a corrected version with improved readability and visual balance. The tool supports multi-language interfaces, theme switching, file drag-and-drop, and detailed progress feedback, aiming to provide a simple and efficient user experience.\n\n## Features\n\n- **Multi-language Support**: Supports both Chinese and English interfaces with easy language switching.\n- **Drag-and-Drop File Selection**: Simply drag and drop your PDF files for easy selection.\n- **Batch Processing**: Process multiple PDF files simultaneously to improve work efficiency.\n- **Real-time Progress Feedback**: Display progress bars and percentages to track processing status.\n- **Theme Switching**: Offers multiple interface themes for personalized appearance.\n- **Customizable Settings**:\n  - **DPI Configuration**: Customize rendering DPI to meet different quality requirements.\n  - **Background Color Selection**: Choose or customize background colors to optimize correction results.\n  - **Image Enhancement**: Remove watermarks, enhance contrast, denoise, and sharpen images.\n- **Logging**: Records important information and errors during processing for debugging and user feedback.\n- **Intuitive Interface**: User-friendly design with icons and tooltips for enhanced usability.\n\n## Installation\n\n### Recommended: Using uv\n\n```bash\nuv tool install pdf-deskew\n```\n\nThis will automatically create two executable commands: `pdf-deskew` (GUI) and `pdf-deskew-cli` (CLI).\n\n### Alternative: Using pip\n\n```bash\npip install pdf-deskew\n```\n\n### From Source (Development)\n\n```bash\ngit clone https://github.com/tinnci/pdf_deskew.git\ncd pdf_deskew\n\n# Create virtual environment\nuv venv .venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n\n# Install in development mode\nuv pip install -e .\n```\n\n## Dependencies\n\nThe tool automatically installs the following dependencies:\n\n- **PyQt6** (>=6.7.1): GUI framework\n- **PyMuPDF** (>=1.24.13): PDF processing\n- **OpenCV** (>=4.10.0.84): Image processing\n- **Pillow** (>=11.0.0): Image manipulation\n- **numpy** (>=2.1.2): Numerical computing\n- **deskew** (>=1.5.1): Skew detection\n- **qt-material** (>=2.14): Theme support\n- **tqdm** (>=4.66.6): Progress bars\n\n## Usage\n\n### GUI Application\n\nStart the application:\n\n```bash\npdf-deskew\n```\n\n**Interface Guide**:\n\n1. **File Selection**:\n   - **Input PDF**: Click \"Browse\" button or drag-and-drop a PDF file\n   - **Output PDF**: Specify save location (default: `input_filename_deskewed.pdf`)\n\n2. **Processing Options**:\n   - **Use Recommended Settings**: DPI=300, white background\n   - **Custom Settings**: Adjust DPI, background color, watermark removal, image enhancement\n   - **Image Processing**:\n     - Remove watermarks (Inpainting)\n     - Enhance images (contrast, denoising, sharpening)\n     - Convert to grayscale\n\n3. **Language & Theme**:\n   - Switch between English and Chinese\n   - Choose from multiple interface themes\n\n### Command-Line Tool\n\nView help:\n\n```bash\npdf-deskew-cli --help\n```\n\nBasic usage:\n\n```bash\n# Simple conversion\npdf-deskew-cli input.pdf\n\n# Specify output\npdf-deskew-cli input.pdf -o output.pdf\n\n# Custom DPI\npdf-deskew-cli input.pdf -d 600\n\n# With enhancements\npdf-deskew-cli input.pdf --enhance --remove-watermark\n\n# Change background\npdf-deskew-cli input.pdf --bg-color black\n```\n\n**Command-line Arguments**:\n- `input`: Input PDF file path (required)\n- `-o, --output`: Output file path (default: `input_deskewed.pdf`)\n- `-d, --dpi`: Rendering DPI, range 72-1200 (default: 300)\n- `--bg-color`: Background color, white or black (default: white)\n- `--enhance`: Enable image enhancement\n- `--remove-watermark`: Enable watermark removal\n- `-v, --version`: Show version number\n\n## System Requirements\n\n- **Operating System**: Windows, macOS, or Linux\n- **Python**: 3.12 or higher\n- **Optional**: [uv package manager](https://docs.astral.sh/uv/) (recommended)\n\n## Notes\n\n- **Special Characters in Paths**: If your file paths contain spaces or special characters, use quotes to avoid errors.\n- **Temporary Files**: The application creates a temporary folder for intermediate images, which is automatically cleaned up after processing.\n- **Logging**: Processing logs are recorded in `pdf_deskew.log` for debugging purposes.\n- **Theme Switching**: Theme changes take effect immediately without requiring application restart.\n\n## Development\n\nTo contribute to this project:\n\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/tinnci/pdf_deskew.git\n   cd pdf_deskew\n   ```\n\n2. **Set Up Environment**:\n   ```bash\n   uv venv .venv\n   source .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n   uv pip install -e .\n   ```\n\n3. **Run Tests**:\n   ```bash\n   pytest\n   ```\n\n4. **Submit Changes**:\n   ```bash\n   git add .\n   git commit -m \"Description of changes\"\n   git push origin your-branch\n   ```\n\n## License\n\nThis project is licensed under the MIT License. You are free to use and modify it.\n\n## Support\n\nFor issues or questions:\n- GitHub Issues: https://github.com/tinnci/pdf_deskew/issues\n- Email: luoyido@outlook.com\n\n---\n\nThank you for using PDF Deskew Tool! If you find it useful, please give us a \u2b50 on GitHub and share it with others who might benefit.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A GUI tool for deskewing scanned PDF documents using PyQt6 and OpenCV",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/Tinnci/pdf_deskew",
        "Issues": "https://github.com/Tinnci/pdf_deskew/issues",
        "Repository": "https://github.com/Tinnci/pdf_deskew.git"
    },
    "split_keywords": [
        "pdf",
        " deskew",
        " image-processing",
        " gui",
        " pyqt6",
        " opencv"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cd88619fc4af49a518659af216c45a29c0f6a8a74d6a287fd0e66200b8eaa6d3",
                "md5": "99ff1bf150628668f151651817c3447a",
                "sha256": "48304137dc28f6f5dbf44780ebd0584a55f775fe05bb4852dc98bb4c46e7d1cd"
            },
            "downloads": -1,
            "filename": "pdf_deskew-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "99ff1bf150628668f151651817c3447a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 23525,
            "upload_time": "2025-10-25T16:56:43",
            "upload_time_iso_8601": "2025-10-25T16:56:43.015110Z",
            "url": "https://files.pythonhosted.org/packages/cd/88/619fc4af49a518659af216c45a29c0f6a8a74d6a287fd0e66200b8eaa6d3/pdf_deskew-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7a5958c542669ca4c0c5470c604eff97ec56ef61aa3b9260a63fdef8e36069bf",
                "md5": "161e0651c57b4e4b751dccf6e2ff70ae",
                "sha256": "d2c815850fb1c9fd919b0d8eb214211ac2e4b81fc66bbf1fd917a8a26b816ff8"
            },
            "downloads": -1,
            "filename": "pdf_deskew-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "161e0651c57b4e4b751dccf6e2ff70ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 23980,
            "upload_time": "2025-10-25T16:56:44",
            "upload_time_iso_8601": "2025-10-25T16:56:44.254060Z",
            "url": "https://files.pythonhosted.org/packages/7a/59/58c542669ca4c0c5470c604eff97ec56ef61aa3b9260a63fdef8e36069bf/pdf_deskew-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-25 16:56:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Tinnci",
    "github_project": "pdf_deskew",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pdf-deskew"
}
        
Elapsed time: 1.43070s