dot art wtf?
Convert your image to grayscale ... for each pixel, use formula Y (luminance) = 0.299R + 0.587G + 0.114B
You get the 256 levels of brightness for each pixel...
Optionally, do another pass to reduce the brightness levels from 256 to maybe 16 or 32 ... see dithering examples
Then you pick a bunch of characters from a font that have different number of dots ... use characters with more dots for darker pixels, characters with less dots for those with more pixels.
RTF is RICH TEXT FORMAT, it's a document with lots of things like DOC or a PDF file, it's not just text. it contains instructions and tags like html has tags (ex. <p> , <b>, <font> ) The RTF file must be loaded and parsed, you can't just read it as a text file and output on console.
Also, RTF as a format was created before UTF-8 was even a thing, so the actual Adobe Braille characters used to generate the image (which are characters with code points that need two or three bytes) are encoded in a special way in the file. The RTF file must be parsed and the program that converts the RTF to pure text must be smart enough to decode the unicode and keep the pure text as UTF-8 in memory and then send it to console properly.
For example, here's what a RTF file with a single smiley character ( ) produced by Wordpad :
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset1 Segoe UI Symbol;}{\f1\fnil\fcharset0 Calibri;}} {\*\generator Riched20 10.0.19041}\viewkind4\uc1 \pard\sa200\sl276\slmult1\f0\fs22\lang9\u-10179?\u-8704?\f1\par }
The actual document starts at \view on the second line , \par defines the first paragraph, and the smiley is basically this part : \u-10179?\u-8704?
If you use Adobe Braille font, each of those characters is such sequence in the RTF document.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now