A Python application that converts images to ASCII art using advanced mathematical methods for symbol selection, including Principal Component Analysis (PCA) for intelligent character mapping.
pip install Pillow numpypython -m src.image_to_ascii.cli --input skull.jpeg --output skull_art.txt --width 80@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- Advanced Symbol Selection: Uses Principal Component Analysis (PCA) for intelligent ASCII character mapping
- Customizable Output: Adjustable width and aspect ratio preservation
- Modular Architecture: Clean, extensible codebase perfect for contributions
- Mathematical Foundation: Implements sophisticated algorithms for optimal visual representation
- File-Based Processing: Supports various image formats through PIL
This project is participating in Hacktoberfest! We have 15 carefully crafted issues ranging from beginner to advanced levels, each with detailed mathematical explanations and implementation guides.
- 🟢 Beginner: Brightness mapping, contrast enhancement, edge detection
- 🟡 Intermediate: Dithering algorithms, frequency domain analysis, adaptive processing
- 🔴 Advanced: Neural networks, wavelets, genetic algorithms, real-time video
git clone https://github.com/yourusername/image-to-ascii.git
cd image-to-ascii
pip install -e .
pytest tests/Detailed documentation is available in the docs/ directory:
- ASCII Generation Process
- Character Mapping Algorithms
- CLI Usage Guide
- Image Loading and Processing
- Output Formats and Saving
We welcome contributions of all skill levels! Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.
- Check out our Hacktoberfest Issues for contribution ideas
- Read our Contributing Guidelines
- Follow our Code of Conduct
The core algorithm uses Principal Component Analysis to match image blocks with ASCII characters:
- Image Preprocessing: Convert to grayscale and resize
- Block Division: Split image into character-sized blocks
- Feature Extraction: Compute PCA features for each block
- Character Matching: Find ASCII character with closest PCA signature
- Output Generation: Assemble final ASCII representation
- PCA Feature Extraction:
eigenvals, eigenvecs = np.linalg.eig(covariance_matrix) - Distance Calculation: Euclidean distance in eigenspace
- Aspect Ratio Correction:
height = int(width * aspect_ratio / 2)
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Python, NumPy, and Pillow
- Mathematical concepts inspired by computer vision research
- Community-driven development through Hacktoberfest
Ready to contribute? Check out our issue tracker and join the fun! 🎃