JaceyPenny / image-to-braille

Converts an image to Braille Unicode art
3 stars 1 forks source link

how do I remove the background dots that are being created in fix_spaces() function? #1

Open ishank-dev opened 4 years ago

ishank-dev commented 4 years ago

I tried changing output[y][x] = '.' to output[y][x] = ' ' but it creates distortion in the image, I want to remove those background dots that are generated to fix space, without actually affecting the image

JaceyPenny commented 4 years ago

I remember having trouble with this because all Braille characters will have the same width as each other, assuming they share the same font, but may not have the same width as the space character. I guess I didn't do much digging, because it turns out there's a "blank" Braille character in Unicode (i.e. the first in this list). Feel free to test it out and open a PR!

ishank-dev commented 4 years ago

I tried replacing it with the blank braille Unicode, the background noise was gone but still, again image got distorted, apparently, the blank braille character width is different than the rest of the braille character. This code somehow seems to achieve the desired But still I would like to find a way that fixes it here also.

ishank-dev commented 4 years ago

Works fine on the terminal.
Screenshot_20200325_183550
After copy pasting it on an editor it shows those background dots Screenshot_20200325_183618 do you know what could be causing this? I tried replacing all the background dots with a white space `` using **find and replace all** in sublime text the output was good and clear, but doing the same through code isn't allowing me to do that. '00 00 00 01': '⢀',`` this is the background white dot. But it doesn't appear on the terminal. Do you know some workaround to fix this? I tried doing

    for i in range(0,len(brl)):
        if(brl[i] == '⢀'):
            brl[i] = ' ' 

But still it's not allowing assigning space to a braille text.

ishank-dev commented 4 years ago

brl = brl.replace('⢀',' ')

Fixed using replace function, but it still distorts the image.