ghnmqdtg / image_watermarking_using_python

A project to implement basic steganography with images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image watermarking using Python

Introduction

This side project is to implement basic steganography with images. Encode the first 7-K bits of the watermark into the last K bits of the target image. You can put these two files in folder ./src and set the configurations in ./config. For details, please refer to the comments in the codes.

Workflow

  1. Import watermark (A) and target (B) as numpy arrays.
  2. Encode the first 7-K bits of A into the last K bits of B.
  3. Decode the last K bits of B and left-shift 7-K bits to reconstruct the A.

Input and Output

Input Images

Target image Watermark image

Encoded Results

Encode to last 1 bit Encode to last 2 bits Encode to last 3 bits

Decoded watermark

Decode from last 1 bit Decode from last 2 bits Decode from last 3 bits

It's easy to encode A to B. As more bits are encoded, the more it affects the quality of the target image. On the contrary, the fewer bits the watermarks are encoded, the lower the quality of it can be restored.

Development Environment

Python 3.9.6
MacOS 12.6

How to use it?

  1. Install the dependencies

    pip install -r requirements.txt
  2. Update the config.py if needed

  3. Run the main.py

    python main.py
<style> td { text-align: center; vertical-align: middle; } .col2 td { max-width:50%; width:50%; } .col3 td { max-width:33%; width:33%; } table { width:100%; } </style>

About

A project to implement basic steganography with images.

License:MIT License


Languages

Language:Python 100.0%