Page 1 of 1

Console ASCII art?

Posted: Thu 07 Oct 2010, 21:04
by dejan555
Thought this would be cool addition to spice up puppy fun even more :)
I used one of those image to ascii convertors from web and saved puppy ascii logo to text file. You can put it anywhere, lets say you have it in /usr/share/doc/asciipup.txt

Add line to /root/.bashrc to read that file on startup:

Code: Select all

cat /usr/share/doc/asciipup.txt
Now every time you run console puppy logo will apear

Here I attach the ascii txt file and screenshot, post your ascii art and examples for beautifying and customizing terminal here, like .Xdefaults for different terminals and stuff, look at this post in dpup thread what I did for urxvt to move scrollbar to right and invert fg/bg
http://www.murga-linux.com/puppy/viewto ... 271#454271

Image

Posted: Thu 14 Oct 2010, 15:28
by DM was on fire!
This is so cool, Dejan!
Anyway to know if I can get this to work in Konsole, or would it only be (u)rxvt?

Posted: Thu 14 Oct 2010, 16:06
by dejan555
It will work in any console as long as it's bash shell when put in .bashrc

Posted: Thu 14 Oct 2010, 20:05
by 01micko
did any one see this one from pizzasgood?

Very festive :wink:

Code: Select all

#!/bin/sh
#Draws a pretty picture
#This looks best in a terminal with a black background.  For example:
#    rxvt -bg black -fg white

h=12
tw=4 #even for alignment
th=3
#increasing this dehances the chrome factor
scarcity=9

###################################################
#define a bunch of colors
#the capitalized versions are "bold" or "bright"

 black='\033[0;30m'
 BLACK='\033[1;30m'
 white='\033[0;37m'
 WHITE='\033[1;37m'

   red='\033[0;31m'
   RED='\033[1;31m'
 green='\033[0;32m'
 GREEN='\033[1;32m'
yellow='\033[0;33m'
YELLOW='\033[1;33m'
  blue='\033[0;34m'
  BLUE='\033[1;34m'
purple='\033[0;35m'
PURPLE='\033[1;35m'
  cyan='\033[0;36m'
  CYAN='\033[1;36m'

    NC='\033[0m'
  grey=$BLACK
###################################################

char1="${green}/${NC}"
char2="${green}^${NC}"
char3="${green}\\\\${NC}"
chart1="${yellow}|${NC}"
chart2="${yellow}=${NC}"
chart3="${yellow}|${NC}"

function draw_bulb(){
        char="*"
        color_pool=($RED $YELLOW $BLUE $CYAN $PURPLE)
        let "index=RANDOM%${#color_pool[@]}"
        echo "${color_pool[$index]}${char}${NC}"
}

function draw_item(){
        boring="$1"
        let 'decision=RANDOM%scarcity'
        if [ $decision -eq 0 ]; then
                draw_bulb
        else
                echo "$boring"
        fi
}

#draw_tree
let 'w=h*2'

let 'cx=w/2'
let 'cy=h/2'

for x in $(seq 0 $cx); do
        line_start="${line_start} "
done
echo -e "${line_start}${WHITE} _A_ ${NC}"
echo -e "${line_start}${WHITE} /^\ ${NC}"

for y in $(seq 1 $h); do
        let 'x1=cx-y+1'
        let 'x2=cx+y-1'
        line=''
        for x in $(seq 0 $x1); do
                line="${line} "
        done
        line="${line} $(draw_item "$char1")"
        let 'start=x1+1'
        let 'end=x2-1'
        for x in $(seq $start 2 $end); do
                line="${line} $(draw_item "$char2")"
                #line="${line} ${char2}"
        done
        line="${line} $(draw_item "$char3")"
        echo -e "$line"
        let 'y++'
done
for y in $(seq 1 $th); do
        let 'x1=cx-tw/2'
        line=''
        for x in $(seq 0 $x1); do
                line="${line} "
        done
        line="${line} ${chart1}"
        let 'start=x1+1'
        let 'end=x1+tw'
        for x in $(seq $start 2 $end); do
                line="${line} ${chart2}"
        done
        line="${line} ${chart3}"
        echo -e "$line"
done

Posted: Thu 14 Oct 2010, 20:17
by dejan555
Cool now I know how to decorate terminal for New Year's Eve :lol:

urxvt ideas

Posted: Sat 16 Oct 2010, 16:26
by upnorth
here is how i configured the prompt in /etc/profile. Find the PS1="# " line and comment it out with a # at the beginning, then create a new one below it:
the "36" determines the color and ">" is the character displayed

PS1=\`pwd\`'\[\033[1;36m\]>\[\033[0m\]'

the pwd above is the linux command for "print working directory"
just replace the "36" above with one of these numbers for a different color for the ">":
  • Black 30
    Blue 34
    Green 32
    Cyan 36
    Red 31
    Purple 35
    Yellow 33
    White 37
here is a new one where the current working directory will be diplayed in red and the symbol displayed will be "=>" in cyan. \w is used here instead of the pwd command to display current working directory.

Code: Select all

PS1='\[\033[1;31m\]\w\[\033[1;36m\]=>\[\033[0m\]' 
see the bash prompt howto at:http://tldp.org/HOWTO/Bash-Prompt-HOWTO/
--------------------------------------------------

After some trial and error and some ideas from archwiki page, i got the Xdefaults to work- with some odd changes though: had to change all "URxvt" to "urxvt" and change some "*" to "." --see code.

Before i just used command line options stored in pinboard (right click console icon, edit item, Arguments to pass.) For example:
-tr -fg white -tint gray -sh 80 -fn "xft:Bitstream Vera Sans Mono:antialias=true:pixelsize=14"
and then add this to end when useing xcompmgr:
-depth 32 -bg rgba:0000/0000/0000/4444
These days, urxvt seems to need an actual .ttf font to work properly with the xft, though. But VeraMono.ttf is only 49k.

my .Xdefaults - don't try this at home.....
this is with the standard small urxvt (138k) included with woof built pups
! is a comment marker in the .Xdefaults so lines beginning with ! are inactive.

Code: Select all

Rxvt.keysym.0xFF50: \033[1~
Rxvt.keysym.0xFF57: \033[4~

# scrollbar style - rxvt (default), plain, next, or xterm
urxvt*scrollstyle:next
urxvt*scrollBar_right:true

!urxvt.geometry: 400x30
urxvt.buffered: true
urxvt.background: black
urxvt.foreground: green
urxvt.cursorColor: blue
urxvt.underlineColor: green
urxvt.font:xft:Bitstream Vera Sans Mono:pixelsize=14:antialias=true

!------------
!True Transparency
!------------
!set to 32-bit for real transparency (compositing required (see xcompmgr)
urxvt.depth:32
!transparent=0000 opaque=ffff
!urxvt*background: rgba:1111/1111/1111/dddd
urxvt.background:rgba:0000/0000/0000/4444
!urxvt*background: rgba:1111/1111/1111/0000


!------------------
!False tranparency
!------------------
!urxvt.transparent: true
!urxvt.shading: 50

urxvt.secondaryScroll:true    # Enable Shift-PageUp/Down in screen
---------------------------------------------------------------------------
Here is an attatchment of my setup for MRXVT,
this seemingly sidesteps the problem with the *@euro locale, however, i don't know how this plays out on systems where nimbus mono L is the only available monospace xft font.

Posted: Sun 17 Oct 2010, 09:30
by GustavoYz
Hello...
I found a nice ASCII Processing sketch online and make a few -littles- changes on it... 8)
For make an ASCII image, replace the JPG inside the folder for another of your choice and resize the pixel proportions of the sketch according to the pixel size of your file (that's the easy way).
Hope you like it.

//PROCESSING CODE HERE-->

Code: Select all

//picture to ascii generator by Chris Webb
//do whatever you want with this. im sure you can improve it heaps :D
 
char[] chars ={'º','1','3','6','o','#','≡','%','$','@','&'};
String loadPath = "Image.jpg";
PImage picture;
int devisions = 5; // pixels
PFont font;
float xDiv;
float yDiv;
 
void setup(){
  picture = loadImage(loadPath);
  size(450,300);
  font = loadFont("ArialMT-24.vlw");
  xDiv = picture.width/devisions;
  yDiv = picture.height/devisions;
  println(xDiv);
}
 
void draw(){
  background(255);
  textFont(font,devisions+3);
  for(int i = 0; i < height; i+= devisions){
    for(int j = 0; j < width; j+= devisions){
      color filler = picture.get(int(j),int(i));
      fill(filler);
      textAlign(CENTER);
      //gets char depending on brightness
      float value = brightness(filler/4);
      char charac = chars[int(value/25.5)];
      text(charac,(j),(i));
    }
  }
}
 
void keyPressed() {
  if (key == CODED) {
    if (keyCode == UP) {
      devisions++;
    } else if (keyCode == DOWN) {
      devisions--;
    }
  }
  constrain(devisions,1,99);
}

http://www.text-image.com/convert/ascii.html

Posted: Mon 18 Oct 2010, 23:48
by upnorth
image to txt, html, or matrix style .png
(works in dillo too)
http://www.text-image.com/convert/ascii.html


this one is for text to ascii art:
(works in dillo too)
http://www.network-science.de/ascii/