T-IMG

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
TecnoGuy458
Posts: 123
Joined: Mon 26 Jan 2015, 20:38
Location: Ohio

T-IMG

#1 Post by TecnoGuy458 »

GitHub: https://github.com/ThomasTheSpaceFox/T-IMG


T-IMG is a Terminal Image System.

primarily designed to allow bash scripts to draw simple images.

current version: v4.1 (T-IMG.sh)
(T-COL.sh: v1.1)

62 colors + a blank character code



COLOR CHARACTER CODES.
R=red
B=blue
G=green
1=white
0=black
C=cyan
Y=yellow
P=purple
O=orange
g=grey
v=blue-violet
V=red-violet
p=pink
c=cyan-green
b=blue-green
y=yellow-green
d=dark-green
l=light-green
x=blue-cyan
Q=light-cyan
z=dark-cyan
Z=dark-blue
X=light-blue
A=Light-Yellow
q=dark-yellow
r=dark-red
F=brown
f=tan
K=light-grey
k=dark-grey
E=red-orange
e=orange-yellow
s=SUPER-white
_=blank
M=SUPER-red
m=SUPER-blue
I=SUPER-green
i=SUPER-orange
u=SUPER-Cyan
U=SUPER-purple
W=SUPER-yellow
w=SUB-red
H=SUB-blue
h=SUB-green
2=SUB-Cyan
3=SUB-purple
4=SUB-yellow
5=MEDHIGH-red
6=MEDHIGH-blue
7=MEDHIGH-green
8=MEDHIGH-Cyan
9=MEDHIGH-purple
S=MEDHIGH-yellow
n=light-purple
t=T-Red
o=T-Blue
a=T-Green
j=T-white
T=T-black
D=T-Cyan
J=T-Purple
N=T-Yellow
L=Light Black

T-COL.sh is a in-line variant of T-IMG.sh that is designed to have data piped to it.

piping Codes to T-COL.sh
where

Code: Select all

$TCOL
points to the path of T-COL.sh

Code: Select all

echo "RRRR>^BBBB>^GGGG>^!" | $TCOL
similarly to a T-IMG image, the sequence ends with

Code: Select all

!
T-COL special escape codes

Code: Select all

>
=escape character

Code: Select all

>^
=escape sequence for an new line.

1st line: image Title
2nd line: mode. 1=one character wide color blocks. 2=two character wide color blocks.

the batch of letters numbers and underscores is the image data itself

"!" line ends the image



Code: Select all

Puppy_Linux
2
____________00000000000000____
___________0kKKKKKKKK0kKK10___
___00000000kKKKKKKKKK0kKKK10__
__0kKKKKK10KKKKKKKKKKK0kKK10__
_0kKKKKKK10KKKKKKKKKKK0kKKK10_
_0kKKKKKKK10KKKKKKKKKKK0kK10__
_0kKKKKKKK10KKKKKKKKKKKK0k10__
_0kKKKKKKK10KKKKKKKKKKKKK00___
_0k000000K10KKKKKKKKKKKKK10___
_00KKKKKK00KKKKKKKKKKK000K10__
_0kKKK0000KKKKKKKKKKK0000010__
_0kKK0000000KKKKKKKKK00000K10_
_0kK00000000KKKKKKKKK00000K10_
_0k00000KK000KKKKKKKKK000KK10_
_0k0000KKKK00KKKKKKKKKKKKKK10_
_0k0000KKKK00KKKKK0000KKK0K10_
_0k00000KK000KK0000000KKKK010_
_0kK00000000KK0000000KKKKK010_
_0kK00000000KKKK0000KKKKK0K10_
__0kKK00000KKKKKK000KKKK0010__
__0kKKKKKKKKKKKKKK00KKK00K10__
__0kKKKKKKKKKKKKKK0K0000KK10__
___0kKKKKKKKK0KKK0KKKKKKK10___
___0kKKKKKKKKK000KKKKKKKK10___
____0kKKKKKKKKKKKKKKKKKK10____
_____0kKKKKKKKKKKKKKKKK10_____
_______0kKKKKKKKKKKKK100______
________00kKKKKKKKK100________
__________00kKK10000__________
____________0000______________
!
example of TIMG image data. this is a TIMG rendition of the puppy logo. see the attached screenshot for what it looks like drawn.
Attachments
Puppy-logo-TIMG-image.tar.gz
i have placed the T-IMG image shown in the attached screenshot in this tarball.
(331 Bytes) Downloaded 146 times
puppyscreenshot1.jpg
Puppy logo TIMG screenshot
(95.82 KiB) Downloaded 330 times
Last edited by TecnoGuy458 on Sun 13 Mar 2016, 00:58, edited 3 times in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hello TecnoGuy458.

Nice. :)

But according to this, you can have 256 rgb colors and perhaps more.

I got to back-track where I found this "perhaps more", but I did see it on an ANSI-
devoted page explaining how to produce various shades -- even over 256 colors.

Continue the good work! The console has many more capabilities than people
usually think!

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#3 Post by technosaurus »

IIRC there was a similar program included in stb_image.h which will decode most imave types including: png, jpg, gif, tga, bmp, pic, pnm, psd, pic and a couple of others. There is another called fbvis which works on a console framebuffer.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

TecnoGuy458
Posts: 123
Joined: Mon 26 Jan 2015, 20:38
Location: Ohio

T-CODE.sh and TIMGTRANS.sh

#4 Post by TecnoGuy458 »

I've created some scripts for converting TIMG images to raw, bash-ready, escape codes.

T-CODE.sh is the actual converter. it outputs to the file output.txt

TIMGTRANS.sh is A wrapper script that converts all the TIMG images in the directory It Is In, (and make sure T-CODE.sh is in the same directory too.)
they will have their same filename except the extension will be: .TC (sample.TIMG would become sample.TC)
these *.TC files can be executed from another script using the source command.

needless to say it greatly speeds up shell scripts, and can be placed in-line, or called from the .TC files. (such as with the source command)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#5 Post by greengeek »

So could you use this to display an image during execution of a normal bash script? eg if I had a script that examined and listed every file on my hard drive and displayed a huge scrolling list in a terminal could TMG be called within that script to display something like a large tick or cross each time a specific type of file was encountered?

Like some sort of visual clue that a user could spot from a distance rather than keeping their eye glued to each line of the scrolling list? (hope that makes sense)

TecnoGuy458
Posts: 123
Joined: Mon 26 Jan 2015, 20:38
Location: Ohio

#6 Post by TecnoGuy458 »

greengeek wrote:So could you use this to display an image during execution of a normal bash script? eg if I had a script that examined and listed every file on my hard drive and displayed a huge scrolling list in a terminal could TMG be called within that script to display something like a large tick or cross each time a specific type of file was encountered?

Like some sort of visual clue that a user could spot from a distance rather than keeping their eye glued to each line of the scrolling list? (hope that makes sense)
yes. though if you need more speed you can run TIMG images through the conversion scripts i mentioned above. these will convert the TIMG image data into bash-execution-ready escape codes. ready to be called directly using the bash "source" command or copied into the script.

do note that T-IMG images require the T-IMG.sh script to draw them. but the converted escape-code form of them (*.TC) are faster and don't require any extra scripts.

though it wouldn't hurt to keep the source TIMG images. the escape codes mentioned above are generated algorithmically, and thus are not easy to read. at all.

though the source T-IMG images are relatively easy to read due to all the color character codes being a single case-sensitive alphanumeric character. it can take some getting used to. though it helps to be looking at the list of color codes.

Post Reply