Giter Club home page Giter Club logo

remove_watermarks's Introduction

PDF Watermark Remover ๐Ÿšซ๐Ÿ–ผ๏ธ

This Python script utilizes the power of PyMuPDF and PIL libraries to identify and remove the most frequently occurring image (often a watermark) from a PDF file. It's an efficient way to clean up your PDFs from unwanted images without compromising the integrity of the document.

Features โœจ

  • Extract Images: Scans through each page of the PDF to extract images.
  • Image Comparison: Utilizes Structural Similarity Index (SSIM) to compare images and identify duplicates or near-duplicates.
  • Remove Most Frequent Image: Identifies the most frequently occurring image across the document and removes it.
  • Save Modified PDF: Outputs a new PDF file with the watermark removed.

Prerequisites ๐Ÿ“‹

Before you can run this script, you need to have Python installed on your machine along with the following Python libraries:

  • PyMuPDF (Fitz)
  • PIL (Pillow)
  • NumPy
  • scikit-image

You can install these dependencies using pip:

pip install -r requirements.txt

Usage ๐Ÿš€

  1. Place the PDF file you want to process in the same directory as the script or specify the path to the file.
  2. Run the script with Python:
python main.py
  1. The script will process the PDF, remove the most frequent image (watermark), and save a modified version of the PDF in the same directory.

How It Works ๐Ÿ› ๏ธ

  1. Extracting Images: The script first extracts all images from the PDF.
  2. Comparing Images: It then compares each image with every other image in the document to find duplicates based on SSIM.
  3. Identifying and Removing the Watermark: The most frequently occurring image is considered the watermark and is removed from the document.
  4. Saving the PDF: Finally, the script saves the modified PDF without the watermark.

Note ๐Ÿ“

  • The script assumes that the most frequent image in the PDF is the watermark. This might not always be the case, so use it with caution.
  • The effectiveness of the watermark removal can vary based on the quality and complexity of the images in the PDF.

Contribution ๐Ÿค

Feel free to fork this project and contribute. Whether it's adding new features, improving the documentation, or fixing bugs, your contributions are always welcome!

License ๐Ÿ“„

This project is licensed under the MIT License - see the LICENSE file for details.

remove_watermarks's People

Contributors

louis-htmlcss avatar

Stargazers

 avatar

Watchers

Neustradamus avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.