Skip to content

jairajrenjith/Line-Art-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Line Art Generator

This project converts an input image into a clean black-and-white line-art drawing using OpenCV and Python.


Features

  • Converts Images to Line Art: Generates a black-and-white sketch version of any input image.
  • Adjustable Line Thickness: Lines can be thicker or thinner based on a single parameter.
  • Automatic Processing: Takes an image from the assets folder and saves the result directly without user interaction.
  • Clean and Clear Output: Produces high-contrast line-art with a white background and visible black outlines.

Project Structure

Line-Art-Generator/
│
├── src/
│ ├── main.py          # Main script that controls processing
│ └── utils.py         # Helper functions for image operations
│
├── assets/            # Input images for processing
│ ├── portrait1.jpg
| └── portrait2.jpg
│
├── results/           # Generated outputs
│ ├── line_art1.jpg
│ └── line_art2.jpg
│
├── requirements.txt   # Python dependencies
└── README.md          # Project documentation

Installation and Setup

  1. Clone the repository:

    git clone <repo-link>
  2. Goto the directory:

    cd Line-Art-Generator
  3. Create a virtual environment:

    python -m venv venv
  4. Activate the environment:

    a. Windows:

    venv\Scripts\activate

    b. Linux / macOS:

    source venv/bin/activate
  5. Install dependencies:

    pip install -r requirements.txt

Usage

Run the project from the root directory:

python src/main.py

How It Works

  1. Convert the input image to Grayscale.
  2. Apply Edge Detection using Canny.
  3. Apply Dilation to thicken edges.
  4. Save the final output image in results\ directory.

Output

The processed line-art image will be saved in the results\ directory. (Each output image corresponding to each input image in the assets\ directory)


Sample Run

Example 1:

Original Input Image 1 Generated Line Art 1

Example 2:

Original Input Image 2 Generated Line Art 2


License

This project is intended for educational and research purposes only.

Made by Jairaj R.

About

Converts an input image into a clean black-and-white line-art drawing using OpenCV and Python.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages