This project converts an input image into a clean black-and-white line-art drawing using OpenCV and Python.
- 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.
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
-
Clone the repository:
git clone <repo-link>
-
Goto the directory:
cd Line-Art-Generator -
Create a virtual environment:
python -m venv venv
-
Activate the environment:
a. Windows:
venv\Scripts\activate
b. Linux / macOS:
source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
Run the project from the root directory:
python src/main.py- Convert the input image to Grayscale.
- Apply Edge Detection using Canny.
- Apply Dilation to thicken edges.
- Save the final output image in
results\directory.
The processed line-art image will be saved in the results\ directory. (Each output image corresponding to each input image in the assets\ directory)
Example 1:
Example 2:
This project is intended for educational and research purposes only.
Made by Jairaj R.



