A web application for converting images into pencil sketches with adjustable quality levels and step-by-step transformation features. Built with Python, OpenCV, and Streamlit for an intuitive user experience.
- Convert uploaded images to pencil sketches
- Adjustable sketch quality settings
- Step-by-step transformation visualization
- Real-time image processing using OpenCV
- Clean, responsive web interface
- Support for common image formats (JPEG, PNG, etc.)
- Frontend: Streamlit web framework
- Image Processing: OpenCV (cv2)
- Computing: NumPy for numerical operations
- Image Handling: Pillow (PIL) for image manipulation
- Deployment: Streamlit Cloud
- Clone the repository:
git clone https://github.com/RoyAalekh/Snap2Sketch.git
cd Snap2Sketch- Install dependencies:
pip install -r requirements.txt- Run the application:
streamlit run app.py- Open your browser to
http://localhost:8501
The application uses computer vision techniques to convert photographs into pencil sketch-like drawings:
- Image Upload: Users upload an image through the web interface
- Preprocessing: Image is converted to grayscale
- Edge Detection: Canny edge detection identifies prominent features
- Sketch Generation: Combination of blur and edge enhancement creates sketch effect
- Quality Control: Adjustable parameters for fine-tuning the output
Snap2Sketch/
├── app.py # Main Streamlit application
├── utils.py # Image processing utilities
├── requirements.txt # Python dependencies
├── components/ # Modular UI components
│ ├── controls.py # Control panel interface
│ ├── display.py # Image display panel
│ ├── header.py # Application header
│ ├── footer.py # Application footer
│ └── image_processor.py # Core image processing logic
└── .devcontainer/ # Development container configuration
- Access the web application through the live demo link
- Upload an image using the file upload interface
- Adjust quality settings as desired
- View the generated pencil sketch
- Download the processed image
The application is built with modular components for maintainability:
- ControlPanel: Handles user inputs and parameter adjustments
- DisplayPanel: Manages image display and processing results
- ImageProcessor: Contains core OpenCV-based processing algorithms
- Python 3.7+
- Streamlit
- OpenCV (opencv-python-headless)
- NumPy
- Pillow
MIT License