Jump to content

dot art wtf?

stefanmz
Go to solution Solved by mariushm,

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.

 

 

How about trying a different font?

Fairy certain "Apple" fonts aren't on Linux, or if they are, they'd be using a different name.

"A high ideal missed by a little, is far better than low ideal that is achievable, yet far less effective"

 

If you think I'm wrong, correct me. If I've offended you in some way tell me what it is and how I can correct it. I want to learn, and along the way one can make mistakes; Being wrong helps you learn what's right.

Link to comment
Share on other sites

Link to post
Share on other sites

you're trying to make the image 500 characters wide but your terminal window isn't wide enough so the terminal is wrapping around. here is me zooming out on a 4k monitor just to get a 400 char wide image...

 

image.thumb.png.3c2df624d2f12f9563efddc940b73971.png

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

Scroll up in the output, you set the width and height way too big, so you only have the last 8 lines there. Those are the width and height of the output in number of characters, not the width and height of the input. It also isn't going to do what you probably want with the braille font. This just takes how "filled in" a character is and correlates that to the lightness of a portion of the image, it won't use the the braille dots as individual "sub-pixels" like I suspect you were hoping for.

 

If you want to use braille anyway, you'll probably want to specify your own characters. It only uses these by default: chars=" .',:;+*?%S#@". Those characters are a good cross section of brightness in a normal font, but that's not the case in a braille font.

Edited by BobVonBob

¯\_(ツ)_/¯

 

 

Desktop:

Intel Core i7-11700K | Noctua NH-D15S chromax.black | ASUS ROG Strix Z590-E Gaming WiFi  | 32 GB G.SKILL TridentZ 3200 MHz | ASUS TUF Gaming RTX 3080 | 1TB Samsung 980 Pro M.2 PCIe 4.0 SSD | 2TB WD Blue M.2 SATA SSD | Seasonic Focus GX-850 Fractal Design Meshify C Windows 10 Pro

 

Laptop:

HP Omen 15 | AMD Ryzen 7 5800H | 16 GB 3200 MHz | Nvidia RTX 3060 | 1 TB WD Black PCIe 3.0 SSD | 512 GB Micron PCIe 3.0 SSD | Windows 11

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, BobVonBob said:

Scroll up in the output, you set the width and height way too big, so you only have the last 8 lines there. Those are the width and height of the output in number of characters, not the width and height of the input. It also isn't going to do what you probably want with the braille font. This just takes how "filled in" a character is and correlates that to the lightness of a portion of the image, it won't use the the braille dots as individual "sub-pixels" like I suspect you were hoping for.

yeah I will try a different font

Link to comment
Share on other sites

Link to post
Share on other sites

15 minutes ago, Sauron said:

you're trying to make the image 500 characters wide but your terminal window isn't wide enough so the terminal is wrapping around. here is me zooming out on a 4k monitor just to get a 400 char wide image...

 

image.thumb.png.3c2df624d2f12f9563efddc940b73971.png

oh I didn't know it was 500 characters I thought that was pixel width. So how many characters would fit in a small terminal window?

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, stefanmz said:

oh I didn't know it was 500 characters I thought that was pixel width. So how many characters would fit in a small terminal window?

100 should be a safe place to start

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, stefanmz said:

oh I didn't know it was 500 characters I thought that was pixel width. So how many characters would fit in a small terminal window?

Your terminal there is 167 characters wide (I think, I didn't count because I'm not insane, but there's one character missing every three lines and 501/3=167) and 27 characters tall.

¯\_(ツ)_/¯

 

 

Desktop:

Intel Core i7-11700K | Noctua NH-D15S chromax.black | ASUS ROG Strix Z590-E Gaming WiFi  | 32 GB G.SKILL TridentZ 3200 MHz | ASUS TUF Gaming RTX 3080 | 1TB Samsung 980 Pro M.2 PCIe 4.0 SSD | 2TB WD Blue M.2 SATA SSD | Seasonic Focus GX-850 Fractal Design Meshify C Windows 10 Pro

 

Laptop:

HP Omen 15 | AMD Ryzen 7 5800H | 16 GB 3200 MHz | Nvidia RTX 3060 | 1 TB WD Black PCIe 3.0 SSD | 512 GB Micron PCIe 3.0 SSD | Windows 11

Link to comment
Share on other sites

Link to post
Share on other sites

No offense, but these are really stupid questions, how about you do some thinking before asking and expecting to get everything ? 

 

How many characters are in your terminal depends on your screen resolution and how big the terminal window is .... I mean how hard it would be to output  0123456789  several times to the console / terminal ... and then you can easily count how many times you see that looped on one line.

Alternatively, you could just take a screenshot and see how many pixels are used to print 10 dots and then simply divide your screen resolution / window size by that size. You'd easily figure how many characters you can see in the terminal.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, Sauron said:

100 should be a safe place to start

 

27 minutes ago, BobVonBob said:

Your terminal there is 167 characters wide (I think, I didn't count because I'm not insane, but there's one character missing every three lines and 501/3=167) and 27 characters tall.

49 minutes ago, Lightwreather JfromN said:

How about trying a different font?

Fairy certain "Apple" fonts aren't on Linux, or if they are, they'd be using a different name.

yup thanks! It worked! Also changing the font worked as well. Now the image prints correctly it's just a bit squished but that's because I need a smaller image to fit in the terminal. Though it prints it by using @ and other characters. I want it printed using dots, only dots. Which font should I use for that?

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

16 minutes ago, stefanmz said:

yup thanks! It worked! Also changing the font worked as well. Now the image prints correctly it's just a bit squished but that's because I need a smaller image to fit in the terminal. Though it prints it by using @ and other characters. I want it printed using dots, only dots. Which font should I use for that?

If you want it printed using braille characters this program won't work. It has no idea what the characters look like, just how white they are. You'll either need to find another program or do the art yourself.

¯\_(ツ)_/¯

 

 

Desktop:

Intel Core i7-11700K | Noctua NH-D15S chromax.black | ASUS ROG Strix Z590-E Gaming WiFi  | 32 GB G.SKILL TridentZ 3200 MHz | ASUS TUF Gaming RTX 3080 | 1TB Samsung 980 Pro M.2 PCIe 4.0 SSD | 2TB WD Blue M.2 SATA SSD | Seasonic Focus GX-850 Fractal Design Meshify C Windows 10 Pro

 

Laptop:

HP Omen 15 | AMD Ryzen 7 5800H | 16 GB 3200 MHz | Nvidia RTX 3060 | 1 TB WD Black PCIe 3.0 SSD | 512 GB Micron PCIe 3.0 SSD | Windows 11

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, BobVonBob said:

If you want it printed using braille characters this program won't work. It has no idea what the characters look like, just how white they are. You'll either need to find another program or do the art yourself.

yeah I did it myself as an rtf file but I couldn't print it I even have a separate forum post here, but I couldn't make the program print the rtf file. And some of the answers suggested stuff that's too complicated and I don't want to bother. I want to either have a simple solution that can print the rtf file correctly(which I can write with code for a minute or 2 minutes) something very simple or I want to make a dotart using this add-on. If you have a simple solution for printing the rtf file properly, please tell me , if not I might have to download a dotted font from the internet and make the program use that. I can do that right? Use a third party font

Screen Shot 2022-09-03 at 1.01.23 AM.png

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, stefanmz said:

yeah I did it myself as an rtf file but I couldn't print it I even have a separate forum post here, but I couldn't make the program print the rtf file. And some of the answers suggested stuff that's too complicated and I don't want to bother. I want to either have a simple solution that can print the rtf file correctly(which I can write with code for a minute or 2 minutes) something very simple or I want to make a dotart using this add-on. If you have a simple solution for printing the rtf file properly, please tell me , if not I might have to download a dotted font from the internet and make the program use that. I can do that right? Use a third party font

Screen Shot 2022-09-03 at 1.01.23 AM.png

I think the problem is you used a braille font instead of braille characters. It looks like braille, but only in that font. To print it properly in a terminal or other places you can't change the font, you would need to use a normal font with the UTF-8 braille characters instead.

¯\_(ツ)_/¯

 

 

Desktop:

Intel Core i7-11700K | Noctua NH-D15S chromax.black | ASUS ROG Strix Z590-E Gaming WiFi  | 32 GB G.SKILL TridentZ 3200 MHz | ASUS TUF Gaming RTX 3080 | 1TB Samsung 980 Pro M.2 PCIe 4.0 SSD | 2TB WD Blue M.2 SATA SSD | Seasonic Focus GX-850 Fractal Design Meshify C Windows 10 Pro

 

Laptop:

HP Omen 15 | AMD Ryzen 7 5800H | 16 GB 3200 MHz | Nvidia RTX 3060 | 1 TB WD Black PCIe 3.0 SSD | 512 GB Micron PCIe 3.0 SSD | Windows 11

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, BobVonBob said:

I think the problem is you used a braille font instead of braille characters. It looks like braille, but only in that font. To print it properly in a terminal or other places you can't change the font, you would need to use a normal font with the UTF-8 braille characters instead.

oh ok I will try that

Link to comment
Share on other sites

Link to post
Share on other sites

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.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, mariushm said:

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.

 

 

yeah that makes sense. That's why I got a bunch of character codes printed out. Yeah well I am going to try to parse the file although I don't know if that will be successful. If not I might just use another image and make it a dotart using the add-on and then use a dotted font from the internet. 

Link to comment
Share on other sites

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×