Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Let Me Concentrate

Name: Anonymous 2012-10-13 9:16

                                      ████    ████                     
                                      ████  ██████                     
                                    ████  ██████                       
                                    ████  ██████                       
                                  ████████████    ██████               
                                  ██████████  ██████████               
                              ▓▓▓▓██████████████████                   
            ▓▓▓▓        ▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓██████                       
          ▓▓▒▒▒▒██  ▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████                     
        ▓▓▒▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██                   
        ██▒▒▒▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██                 
      ██▒▒▒▒▒▒██▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒██               
    ██▒▒▒▒▒▒▒▒▓▓░░░░░░▓▓▒▒▒▒▒▒▒▒▒▒▓▓░░░░░░▒▒▓▓▒▒▒▒▒▒▒▒████             
  ██▒▒▒▒▒▒▒▒██░░░░██░░▒▒▓▓▒▒▒▒▒▒▓▓░░░░██░░░░▒▒▓▓▒▒▒▒██▒▒▒▒██           
  ██▒▒▒▒▒▒▒▒██░░░░░░░░▒▒▓▓▒▒▒▒▒▒██░░░░░░░░░░▒▒██▒▒████▒▒▒▒▒▒██         
██▒▒▒▒▒▒▒▒▒▒██▓▓░░░░▒▒▒▒██████▒▒▒▒▓▓░░░░░░▒▒▓▓▒▒██▒▒▒▒▒▒▒▒▒▒██         
██▒▒▒▒▒▒▒▒▒▒██▒▒▓▓▓▓▓▓██░░░░▒▒████▒▒▓▓████▓▓▒▒▒▒██▒▒▒▒▒▒▒▒▒▒▒▒██       
██▒▒▒▒▒▒▒▒▒▒▓▓██▒▒████░░░░░░▒▒▒▒▓▓████▓▓▒▒▒▒▒▒▒▒▒▒██▒▒▒▒▒▒▒▒▒▒██       
██▓▓▒▒▒▒▒▒▓▓▓▓████░░██░░░░░░██▒▒▓▓▓▓▓▓▓▓██▒▒▒▒▓▓▓▓██▒▒▒▒▒▒▒▒▒▒▓▓██     
  ██▓▓▓▓▓▓▓▓▓▓▓▓██░░▓▓░░░░▓▓▒▒▒▒▒▒▓▓▓▓▓▓██▓▓▓▓▓▓▓▓██▒▒▒▒▒▒▒▒▒▒▓▓██     
  ██▓▓▓▓▓▓▓▓▓▓██░░░░░░░░░░░░░░▒▒▒▒▓▓▓▓██▓▓▓▓▓▓████▓▓▒▒▒▒▒▒▒▒▓▓▓▓██     
    ██▓▓▓▓▓▓████░░░░░░░░░░░░░░▒▒▓▓▓▓▓▓████████▓▓██▓▓▓▓▒▒▒▒▓▓▓▓▓▓██     
      ████▓▓██░░░░░░░░░░░░░░▒▒▒▒▓▓▓▓██▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓██       
          ██░░░░░░░░░░░░░░░░▒▒▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██       
        ██░░░░░░░░░░░░░░░░▒▒▒▒▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██         
        ██▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██         
          ██▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██      ████ 
          ██████▓▓▓▓▓▓▓▓▓▓██████▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██  ████▒▒▒▒██
          ██▒▒▒▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▒▒▒▒▒▒▒▒██
        ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▒▒██ 
        ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓██ 
        ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓██   
        ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓██   
          ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓██     
          ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓██       
            ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████         
              ██▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒▒▓▓▒▒▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██             
                ████▓▓▒▒▒▒▓▓▒▒▓▓▒▒▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓████               
              ████▓▓██████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████████                 
          ████▒▒▒▒▓▓▓▓▓▓▓▓████████████████████▓▓▓▓▓▓▓▓██               
        ██▒▒▒▒▓▓▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓██      ██▓▓▓▓▓▓▒▒▓▓▓▓▓▓████           
          ████▒▒▒▒██▒▒▒▒▓▓██████      ██▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓██         
            ████████▓▓▓▓████          ██▒▒▒▒▒▒██▒▒▒▒▓▓▓▓▓▓▓▓██         
                  ██████                ████████▓▓▒▒▒▒██████           
                                                ████████               
                                                                       

Name: Anonymous 2012-10-13 13:30

>>30
That's nice, I hope you haven't done that manually.

Actually a fair bit is done manually, I have to find some pixel/gif art on the web, crop, desaturate, adjust light and contrast, and export the optimized image as ASCII .pgm file.
Then I just filter it on stdout with naive printfs.


/*
 * ============================================================
 *
 *       Filename:  pgm2char.c
 *          Usage:  cat file.pgm | ./pgm2char
 *
 *    Description:  Take an image file in PGM format as input
 *                  and output ``utf8 art'' graphics on stdout
 *                  █ U+2588 FULL BLOCK
 *                  ░ U+2591 LIGHT SHADE
 *                  ▒ U+2592 MEDIUM SHADE
 *                  ▓ U+2593 DARK SHADE
 *
 *       Compiler:  gcc
 *
 *         Author:  Anonymous
 *        Comment:  - Code looks very much like K&R Level 1,
 *                  and that's precisely what it was:
 *                  some shit done as exercise
 *                  while reading Chapter I.
 *                  - Conversion to .pgm is done with Gimp,
 *                  Some other program might add comment lines
 *                  that will break execution.
 *                  You're on your own.
 *
 * ============================================================
 */



#include <stdio.h>
#include <stdlib.h>

#define MAXDIGIT 5

char WIDTH[MAXDIGIT];
char HEIGHT[MAXDIGIT];
int W;
int H;
char dark[] = "██";
char darkshade[] = "▓▓";
char mediumshade[] = "▒▒";
char lightshade[] = "░░";
char light[] = "  ";
int main()
{
  int i, c;
  int linecount = 0;
  int columncount = 0;
  char pixel[2];
  int pixelvalue; 

  printf("[sub][sub][sub][sub][m]");

  /* skip .pgm file comment (2 lines, here) */
  while ((c = getchar()) != '\n');
  while ((c = getchar()) != '\n');
 
  i=0;
  while ((c = getchar()) != ' ') {
    WIDTH[i++] = c;
  }
  i=0;
  while ((c = getchar()) != '\n') {
    HEIGHT[i++] = c;
  }

  W = atoi(WIDTH);
  H = atoi(HEIGHT);

  /* skip another line */
  while ((c = getchar()) != '\n');

  /* output pixel values as rectangle characters */
  while (linecount < H) {
    i = 0;
    while ((c = getchar()) != '\n') {
      pixel[i++] = c;
    }
    pixelvalue = atoi(pixel);
    i = 0;
    while (i < 3) {
      pixel[i++] = '\0';
    }
    if (pixelvalue > 204)
      printf(light);
    if (pixelvalue > 153 && pixelvalue <= 204)
      printf(lightshade);
    if (pixelvalue > 102  && pixelvalue <= 153)
      printf(mediumshade);
    if (pixelvalue > 51 && pixelvalue <= 102)
      printf(darkshade);
    if (pixelvalue <= 51)
      printf(dark);

    if (columncount == W - 1) {
      printf("\n");
      columncount = 0;
      linecount++;
    }
    else columncount++;   
  }

  printf("[/m][/sub][/sub][/sub][/sub]");
  return(0);
}


Now the same thing in one line of your favorite script language

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List