Developed with 🧠 by Shoaib Alam (AI Engineer at JPMC | NLP Researcher @ IIT Gandhinagar | Hybrid RAG Pioneer)
A web application that transforms photos into beautiful line art sketches. Upload an image or capture one with your camera, and the app will remove the background and convert it into a clean line sketch.
- Upload Images: Drag & drop or click to upload images
- Camera Capture: Take photos directly with your device camera
- Background Removal: AI-powered background removal using rembg
- Line Sketch Conversion: Clean edge detection using OpenCV
- Download Results: Save both the background-removed image and the sketch
- Backend: Python Flask
- Image Processing: OpenCV, rembg, Pillow
- Frontend: HTML5, CSS3, JavaScript
-
Clone or navigate to the project directory:
cd Image_sketch -
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
Note: The first run will download the rembg AI model (~170MB), which may take a few minutes.
-
Start the Flask server:
python app.py
-
Open your browser and navigate to:
http://localhost:5001Note: We use port 5001 because port 5000 is often used by macOS Control Center.
- Choose between Upload or Camera tab
- Select or capture an image
- Click Generate Sketch to process
- View the results and download your sketch
Ctrl/Cmd + Enter: Process imageEscape: Clear previewSpace: Capture photo (when camera is active)
Image_sketch/
├── app.py # Flask backend with image processing
├── requirements.txt # Python dependencies
├── README.md # This file
├── static/
│ ├── css/
│ │ └── style.css # Modern dark theme styling
│ └── js/
│ └── main.js # Frontend logic
└── templates/
└── index.html # Main UI template
- Background Removal: Uses the
rembglibrary which leverages a U2-Net model to isolate the subject from the background - Edge Detection: Applies OpenCV's Canny edge detection algorithm to extract clean outlines
- Post-processing: Gaussian blur reduces noise, and edge dilation enhances line visibility
MIT License

