simple-image2ascii is a Python library that transforms images and videos into ASCII art using NumPy and OpenCV.
Install the library using pip:
pip install simple-image2asciiimport cv2
import simple_image2ascii
# Load an image
image = cv2.imread("example.jpg")
# Create an ASCIIEngine instance
engine = simple_image2ascii.ASCIIEngine()
# Convert to ASCII
ascii_art = engine.get_ascii(image)
# Print the result
print(ascii_art)import cv2
import simple_image2ascii
cap = cv2.VideoCapture("video.mp4")
engine = simple_image2ascii.ASCIIEngine()
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
ascii_frame = engine.get_ascii(frame)
print(ascii_frame)
cap.release()β Grayscale conversion β Adaptive ASCII mapping β 8Γ8 pixel block processing β Supports image resizing β Works with both images and videos
numpyopencv-python
To install dependencies manually:
pip install numpy opencv-pythonThis project is licensed under the MIT License.
π GitHub: AlekseyScorpi