Overview of ITOA: Image to ASCII Converter
main<span> tags with inline RGB styling. The tool also allows for size adjustments (Small, Medium, Large) and provides the ability to export the resulting ASCII art as a PNG image.repository·main·Indexed 41 days ago
https://github.com/solst-ice/itoaA web-based utility that converts JPG, PNG, and GIF images into ASCII art. Version 0.1.0 supports monochrome and color modes using HTML span tags for RGB styling, customizable character presets, and the ability to export the resulting ASCII art as a PNG image.
<span> tags with inline RGB styling. The tool also allows for size adjustments (Small, Medium, Large) and provides the ability to export the resulting ASCII art as a PNG image.The conversion follows a three-step pipeline:
0.299R + 0.587G + 0.114B. This brightness is then mapped to the character set .:-=+*#%@ (ordered from darkest to brightest).<span style="color: rgb(R, G, B)"> tag to preserve the original pixel color.The core conversion logic uses a convertToAscii function that takes an image file and an optional custom character set. It calculates the appropriate dimensions to preserve the aspect ratio, accounts for the character aspect ratio (typically 0.6), and generates both a monochrome text version and a colored HTML version (using <span> tags with RGB colors).
const convertToAscii = useCallback(async (file, customChars = null) => {
// ... implementation details ...
}, [size, asciiChars])The handleSaveAscii function renders the current ASCII art (either monochrome or colored) onto a high-resolution HTML5 Canvas and triggers a download.
#ff2b9d).navigator.share API to share the generated image file directly.const handleSaveAscii = () => {
// ... implementation details ...
}The converter includes several built-in character sets (presets) to change the visual style of the ASCII art. You can select these from the preset dropdown or provide your own custom string of characters in the input field.
const charPresets = {
'Standard': ' .:-=+*#%@',
'Detailed': ' .\'"`,^:;Il!i><~+_-?][}{1)(|\\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$',
'Blocks': ' ░▒▓█',
'Triangles': ' ◺◹◸◿▸▹►▻▷▶',
'Simple': ' .-+*#@',
'Binary': '01',
'Minimal': ' .@',
'Dots': ' .·•●',
'Circles': ' ○◌◍◐◑●',
'Squares': ' ▫▪◽◾◻◼',
'Shades': ' ░▒▓█',
'Lines': ' -=≡',
'Slashes': ' /\\|',
'Arrows': ' ←↑→↓',
'Box Drawing': ' ─│┼╬█',
'Brackets': ' ()[]{}',
'Waves': ' ∼≈≋',
'Stars': ' .·*✦✧★',
'Cards': ' ♤♡♢♧',
'Music': ' ♪♫♬',
'Currency': ' ¢$€£¥',
'Math': ' ∙·+×÷',
'Dingbats': ' ○◇◊◆',
'Braille': ' ⠁⠃⠇⠏⠟⠿⣿',
'Runes': ' ᚁᚂᚃᚄᚅᚆᚇᚈ',
'Greek': ' αβγδεζηθ',
'Japanese': ' 。あいうえおかきくけこ'
}