Picture to text converter
#9
Lightbulb 
I guess the colons and exclamation points at the top and bottom lines of the built screen are intentional.

It's difficult with the mouse to set some values with the sliders. For the life of me I cannot get to 200 text rows (middle slider), and I cannot set the minimum value less than 640x640.

I changed this program a bit so it worked on Linux. With the way I changed it, it was meant to be run at the terminal command line. The first parameter is the full path to an image file. It could be easily changed to use the fancy open-file dialog. The "saved.bmp" part wasn't changed. I show the changes from the top up to and including "pic_size = 500" line.

The check has to do firstly with the path to the monospaced font file, and secondly with the font file. The "DejaVuSansMono" is being targeted because Manjaro in particular doesn't have an actual font file called "Monospace". It's treated like a "tag" set eg. in Kate which is irritating.

EDIT: Fedora 37 doesn't carry "lsb_release" in the ISO's, must be installed. It does have "inxi". It was a PITA otherwise being different from Manjaro and Slackware, and not having the font file that I desired. That ugly-ass "Google Noto" LOL. Of course this could be changed to another monospaced font which exists on the system.

Darn it, became full of myself writing the above! Thank you to the writers of "setup_lnx.sh" for QB64PE, to obtain a way to get which Linux distro is running.

Code: (Select All)
Dim Shared pic, contrast, brightness, contrast_ref, char_collection$


'changes settings !

picture$ = command$(1) ' <------ set a picture
if picture$ = "" then
    print "Please give the name of a picture as command-line argument!"
    end
end if
if not _fileexists(picture$) then
    print "Please give the full path name of a picture that exists!"
    end
end if

char_collection$ = "'+0123456789.?!=:>()<%/-,ABCDEFGHIJKLMNOPQRSTVXYZUWabcdefghijklmnopqrstvxyzuw" '<----- characters used
'char_collection$ = "0123456789"
$IF WIN THEN
type_s$ = Environ$("systemroot") + "/fonts/arial.ttf" '<------ font type
$ELSE
'thanks to "qb64pe/setup_lnx.sh"
afile$ = "/tmp/distro_name.txt"
zcmd$ = "lsb_release -si > " + afile$
sta% = _shellhide(zcmd$)
if sta% > 0 then
    zcmd$ = "inxi -x -S > " + afile$
    stu% = _shellhide(zcmd$)
end if
atext$ = ""
if _fileexists(afile$) then
    ff& = freefile
    open afile$ for input as ff&
    line input #ff&, atext$
    if sta% > 0 then
        for ii% = 1 to 3
            if instr(atext$, "Distro: ") > 0 then exit for
            if eof(ff&) then exit for
            line input #ff&, atext$
        next
    end if
    close ff&
end if
'only four distros are tested LOL, need to test Fedora on my other HP laptop
if instr(atext$, "Manjaro") > 0 or instr(atext$, "slackware") > 0 then
    type_s$ = "/usr/share/fonts/TTF/DejaVuSansMono.ttf"
elseif instr(atext$, "Fedora") > 0 then
    'geez I despise this font with that godawful "r"
    type_s$ = "/usr/share/fonts/google-noto-vf/NotoSansMono-VF.ttf"
else
    'this should be for Debian
    type_s$ = "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
end if
$END IF

'------------------------------------------------------------------------------------------------------------------------------


pic_size = 500
Reply


Messages In This Thread
Picture to text converter - by MasterGy - 12-06-2022, 07:21 PM
RE: Picture to text converter - by Pete - 12-06-2022, 08:04 PM
RE: Picture to text converter - by bplus - 12-06-2022, 09:03 PM
RE: Picture to text converter - by MasterGy - 12-06-2022, 09:09 PM
RE: Picture to text converter - by Pete - 12-06-2022, 09:27 PM
RE: Picture to text converter - by MasterGy - 12-06-2022, 09:34 PM
RE: Picture to text converter - by mnrvovrfc - 12-06-2022, 10:03 PM
RE: Picture to text converter - by Pete - 12-06-2022, 10:14 PM
RE: Picture to text converter - by mnrvovrfc - 12-06-2022, 10:34 PM
RE: Picture to text converter - by bplus - 12-06-2022, 10:58 PM
RE: Picture to text converter - by Pete - 12-07-2022, 04:24 AM
RE: Picture to text converter - by ChiaPet - 12-07-2022, 07:41 PM
RE: Picture to text converter - by bplus - 12-07-2022, 08:14 PM
RE: Picture to text converter - by Pete - 12-07-2022, 08:18 PM
RE: Picture to text converter - by MasterGy - 12-07-2022, 10:01 PM
RE: Picture to text converter - by MasterGy - 12-07-2022, 11:13 PM



Users browsing this thread: 3 Guest(s)