Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Cartoonifier

A Flask-based web application that transforms photographs into cartoon-style images using advanced image processing techniques with OpenCV. Upload any image and watch it transform into an artistic cartoon version! Features

  1. Web-based Interface: Clean, intuitive UI with a modern design
  2. Fast Processing: Real-time image cartoonification using K-means clustering
  3. Multiple Format Support: Accepts PNG, JPG, and JPEG images
  4. Edge Detection: Intelligent edge detection using adaptive thresholding
  5. Color Quantization: Reduces the color palette for an artistic cartoon effect
  6. Responsive Design: Works seamlessly on desktop and mobile devices
  7. Dark Theme UI: Modern glassmorphism design with animated background

How It Works The cartoonification process involves:

Grayscale Conversion: Converting the image to grayscale for edge detection Median Blur: Applying blur to reduce noise Edge Detection: Using adaptive thresholding to detect image edges K-means Clustering: Reducing colors to create a simplified, artistic palette Edge Overlay: Combining edges with the color-reduced image for the final cartoon effect

Installation Prerequisites

  • Python 3.7 or higher
  • pip (Python package manager)

Setup

Clone the repository:

bash git clone https://github.com/anshjain0316/Image-Cartoonifier.git cd Image-Cartoonifier

Create a virtual environment (recommended):

bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

Install dependencies:

bash pip install -r requirements.txt

Usage

  1. Start the Flask application:

bashpython app.py

  1. Open your browser and navigate to:

http://localhost:5000

  1. Select an image from your device
  2. Click the "Cartoonify!" button
  3. Download or view the cartoonized result

Project Structure Image-Cartoonifier/ ├── app.py # Flask backend server ├── requirements.txt # Python dependencies ├── templates/ │ └── index.html # Frontend HTML ├── static/ │ ├── style.css # Styling │ ├── script.js # Frontend logic │ └── bg.jpg # Background image ├── uploads/ # Temporary upload folder └── cartoonized_images/ # Output cartoonized images

Technical Details Dependencies

  • Flask: Web framework for Python
  • OpenCV (cv2): Computer vision library for image processing
  • NumPy: Numerical computing library

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages