├── README.md ├── NEWS ├── tests ├── 1x1-inv.txt ├── dalsnuten-jp2a-2000x2000-md5.txt ├── Makefile ├── test-term.txt ├── jp2a.jpg ├── grind.jpg ├── logo-40x25-gray.jpg ├── dalsnuten-640x480-gray-low.jpg ├── 10h.txt ├── html-title.txt ├── html-raw.txt ├── 40x40.txt ├── normal.txt ├── flip-xy-invert.txt ├── normal-clear.txt ├── normal-b.txt ├── dalsnuten-invert.txt ├── dalsnuten-normal.txt ├── grind.txt ├── grind-blue.txt ├── grind-green.txt ├── grind-red.txt ├── logo-30.txt ├── 110x30-i-b.txt ├── dalsnuten-80x49-inv.txt ├── dalsnuten-color.txt ├── 2xnormal-b.txt ├── logo.html ├── normal-verbose.txt ├── dalsnuten-256.html ├── dalsnuten-256-light.html ├── run-tests.sh ├── grind-color.txt ├── dalsnuten-640x480-gray-low.txt ├── dalsnuten-640x480-rgb-low.txt ├── grind-2grayscale-fill.txt ├── 160x49.txt └── grind-fill.txt ├── INSTALL ├── src ├── Makefile.am ├── aspect_ratio.c ├── html.c ├── jp2a.c ├── term.c ├── curl.c ├── options.c └── image.c ├── AUTHORS ├── include ├── round.h ├── aspect_ratio.h ├── image.h ├── jp2a.h └── options.h ├── autogen.sh ├── .gitignore ├── Makefile.am ├── BUGS ├── configure.ac ├── README ├── man └── jp2a.1 ├── ChangeLog ├── LICENSES └── COPYING /README.md: -------------------------------------------------------------------------------- 1 | README -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | See ChangeLog 2 | -------------------------------------------------------------------------------- /tests/1x1-inv.txt: -------------------------------------------------------------------------------- 1 | ' 2 | -------------------------------------------------------------------------------- /tests/dalsnuten-jp2a-2000x2000-md5.txt: -------------------------------------------------------------------------------- 1 | 8004000 2 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | check: test 2 | 3 | test: 4 | ./run-tests.sh 5 | -------------------------------------------------------------------------------- /tests/test-term.txt: -------------------------------------------------------------------------------- 1 | Terminal type 'dummy-term' not recognized. 2 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | See the README file for building and installation instructions. 2 | -------------------------------------------------------------------------------- /tests/jp2a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslarsen/jp2a/HEAD/tests/jp2a.jpg -------------------------------------------------------------------------------- /tests/grind.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslarsen/jp2a/HEAD/tests/grind.jpg -------------------------------------------------------------------------------- /tests/logo-40x25-gray.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslarsen/jp2a/HEAD/tests/logo-40x25-gray.jpg -------------------------------------------------------------------------------- /tests/dalsnuten-640x480-gray-low.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslarsen/jp2a/HEAD/tests/dalsnuten-640x480-gray-low.jpg -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = jp2a 2 | jp2a_SOURCES = aspect_ratio.c html.c term.c curl.c jp2a.c options.c image.c 3 | AM_CPPFLAGS = -I../include 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | jp2a is written by Christian Stigen Larsen 2 | 3 | This program uses dynamically linked libraries from other authors. 4 | For an overview, see the file LICENSES. 5 | -------------------------------------------------------------------------------- /include/round.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #ifndef INC_JP2A_ROUND_H 7 | # define ROUND(xfloat) (int) ( 0.5f + xfloat ) 8 | #endif 9 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | autoreconf -vi 3 | 4 | while (( "$#" )); do 5 | if [ $1 == "-c" ]; then 6 | ./configure --with-jpeg-prefix=/usr/local \ 7 | --with-curl-config=`which curl-config` 8 | fi 9 | shift 10 | done 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.o 3 | Makefile 4 | Makefile.in 5 | aclocal.m4 6 | autom4te.cache 7 | compile 8 | config.h 9 | config.h.in 10 | config.log 11 | config.status 12 | configure 13 | depcomp 14 | install-sh 15 | missing 16 | src/.deps 17 | src/jp2a 18 | stamp-h1 19 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | VERSION = @VERSION@ 2 | SUBDIRS = src 3 | man_MANS = man/jp2a.1 4 | EXTRA_DIST = tests/??*.txt tests/??*.html tests/??*.jpg tests/run-tests.sh tests/Makefile include/??*.h man/jp2a.1 LICENSES 5 | 6 | test: check 7 | 8 | check: all 9 | $(MAKE) -C tests check 10 | -------------------------------------------------------------------------------- /include/aspect_ratio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #ifndef INC_JP2A_ASPECT_RATIO_H 7 | 8 | void aspect_ratio(const int jpeg_width, const int jpeg_height); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /tests/10h.txt: -------------------------------------------------------------------------------- 1 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 2 | MMNNMMMMMMMMMMMMMNXXWMMMMMMMMMMM 3 | MW:'XMMMMMMMMMMx. .oWMMMMMMMMM 4 | M0..xN;.';'.;OM00NX' .XWo::;.,OM 5 | MO oN. 'NN, .NMMMx .0MWOkoc cM 6 | MO oN. .xx. ,WWO, ;cxX. ;k. ;X 7 | Mx oN. .lclxNM0llllllxWxcldoclO 8 | W; ,XN' ;MMMMMMMMMMMMMMMMMMMMMMM 9 | MWNMMMNNNMMMMMMMMMMMMMMMMMMMMMMM 10 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 11 | -------------------------------------------------------------------------------- /tests/html-title.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | just testing 6 | 17 | 18 | 19 |
20 | XNMMWk0MMM
21 | ol'c0x:Oco
22 | 0X0MMMMMMM
23 | 
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /include/image.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #ifndef INC_JP2A_IMAGE_H 7 | 8 | #ifdef HAVE_CONFIG_H 9 | #include "config.h" 10 | #endif 11 | 12 | #ifdef HAVE_STDLIB_H 13 | #include 14 | #undef HAVE_STDLIB_H 15 | #endif 16 | 17 | #include 18 | 19 | #include "jpeglib.h" 20 | 21 | typedef struct rgb_t { 22 | JSAMPLE r, g, b; 23 | } rgb_t; 24 | 25 | typedef struct image_t { 26 | int w, h; 27 | rgb_t *pixels; 28 | } image_t; 29 | 30 | image_t* image_read(FILE *f); 31 | image_t* image_new(int width, int height); 32 | void image_destroy(image_t *p); 33 | void image_clear(image_t *p); 34 | void image_print(const image_t *p, FILE *fout); 35 | void image_resize(const image_t* restrict s, image_t* restrict d); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/jp2a.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #ifndef INC_JP2A_H 7 | 8 | #include 9 | 10 | // curl.c 11 | #ifdef FEAT_CURL 12 | int is_url(const char* s); 13 | int curl_download(const char* url, const int debug); 14 | #endif 15 | 16 | // html.c 17 | void print_html_start(const int fontsize, FILE *fout); 18 | void print_html_end(FILE *fout); 19 | void print_html_char(FILE *fout, const char ch, 20 | const int red_fg, const int green_fg, const int blue_fg, 21 | const int red_bg, const int green_bg, const int blue_bg); 22 | void print_html_newline(FILE *fout); 23 | 24 | // image.c 25 | void decompress(FILE *fin, FILE *fout); 26 | 27 | // options.c 28 | void parse_options(int argc, char** argv); 29 | 30 | // term.c 31 | int get_termsize(int* width_, int* height_, char** error); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /include/options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #ifndef INC_JP2A_OPTIONS_H 7 | 8 | // see options.c 9 | extern int verbose; 10 | extern int auto_height; 11 | extern int auto_width; 12 | extern int width; 13 | extern int height; 14 | extern int use_border; 15 | extern int invert; 16 | extern int flipx; 17 | extern int flipy; 18 | extern int html; 19 | extern int html_fontsize; 20 | extern int colorfill; 21 | extern int convert_grayscale; 22 | extern const char *html_title; 23 | extern int html_rawoutput; 24 | extern int html_bold; 25 | extern int debug; 26 | extern int clearscr; 27 | extern char ascii_palette[]; 28 | extern float redweight, greenweight, blueweight; 29 | extern float RED[256], GREEN[256], BLUE[256], GRAY[256]; 30 | extern const char *fileout; 31 | extern int usecolors; 32 | extern int termfit; 33 | extern int term_width; 34 | extern int term_height; 35 | #define TERM_FIT_ZOOM 1 36 | #define TERM_FIT_WIDTH 2 37 | #define TERM_FIT_HEIGHT 3 38 | #define TERM_FIT_AUTO 4 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /tests/html-raw.txt: -------------------------------------------------------------------------------- 1 | XNMMWk0MMM
ol'c0x:Oco
0X0MMMMMMM
-------------------------------------------------------------------------------- /BUGS: -------------------------------------------------------------------------------- 1 | Things to do: 2 | - Add --html-title="..." 3 | - Add --html-imageonly, which gives JUST the image data, so you can embed the image and format 4 | the page in your own style. 5 | 6 | TODO 7 | - What about making a Windows installer? 8 | - What about making a small GUI for windows? If run, open a file browser, then convert and display 9 | result in notepad, or internet explorer. 10 | - About process_scanline, it might be much better (clearer, faster) to pass a function pointer to the 11 | read pixels algorithm, so we don't have to do all those "if"s in the innerloop. Might also be slower, though, 12 | because of the increased stack pushing and popping. 13 | - Check j2pa --color ~/tmp/cola.jpg, should not get blue color there, because we are using grayscale colors! 14 | - Consider using Bresenham scaling (search for "Image scanling with Bresenham" on DDJ.com) 15 | - Consider using other libs for image conversions, e.g. would be nice to read GIF and PNG. (See libpng, gdlib.) 16 | 17 | BUGS 18 | - Using --term-fit and multiple files, the fit only works for the first image. 19 | - Floating-point calculation (and rounding) is not 100% equal from compiler to compiler. Try to fix this. 20 | -------------------------------------------------------------------------------- /src/aspect_ratio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #include "options.h" 7 | #include "round.h" 8 | 9 | // Calculate width or height, but not both 10 | void aspect_ratio(const int jpeg_width, const int jpeg_height) { 11 | 12 | // the 2.0f and 0.5f factors are used for text displays that (usually) have characters 13 | // that are taller than they are wide. 14 | 15 | #define CALC_WIDTH ROUND(2.0f * (float) height * (float) jpeg_width / (float) jpeg_height) 16 | #define CALC_HEIGHT ROUND(0.5f * (float) width * (float) jpeg_height / (float) jpeg_width) 17 | 18 | // calc width 19 | if ( auto_width && !auto_height ) { 20 | width = CALC_WIDTH; 21 | 22 | // adjust for too small dimensions 23 | while ( width==0 ) { 24 | ++height; 25 | aspect_ratio(jpeg_width, jpeg_height); 26 | } 27 | 28 | while ( termfit==TERM_FIT_AUTO && (width + use_border*2)>term_width ) { 29 | width = term_width - use_border*2; 30 | height = 0; 31 | auto_height = 1; 32 | auto_width = 0; 33 | aspect_ratio(jpeg_width, jpeg_height); 34 | } 35 | 36 | } 37 | 38 | // calc height 39 | if ( !auto_width && auto_height ) { 40 | height = CALC_HEIGHT; 41 | 42 | // adjust for too small dimensions 43 | while ( height==0 ) { 44 | ++width; 45 | aspect_ratio(jpeg_width, jpeg_height); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/40x40.txt: -------------------------------------------------------------------------------- 1 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 2 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 3 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 4 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 5 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 6 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 7 | MMWk0MMMMMMMMMMMMMMMMXkxkXMMMMMMMMMMMMMM 8 | MMk .XMMMMMMMMMMMMMWO; 'KMMMMMMMMMMMMM 9 | MMo OMMMMMMMMMMMMMk. cWMMMMMMMMMMMM 10 | MMo OMMMMMMMMMMMMW; .KMMMMMMMMMMMM 11 | MM0,cNMMMMMMMMMMMMW' . oMMMMMMMMMMMM 12 | MMKOOXMN00KWOxKMMMW' ckc :MMMWXkxkNMMM 13 | MWc''xMk''cd..,OMMW:oNMX. :MMWx;...cXMM 14 | MW, oMo .. 'XMWONMMM; :MMk. lMM 15 | MW, oMo cWMWMMMM: cMW, .. .0M 16 | MW, oMo .; .KMMMMMW, xMW'.xKd xM 17 | MW, oMo .OX: kMMMMMN. 0MW:xMMN. dM 18 | MW, oMo ,WMk xMMMMMO 'NMWOWMWO. dM 19 | MW, oMo ;MMX. oMMMMW: dMMMWNx:. dM 20 | MW, oMo ,MMN. oMMMMO 'NMMMX: .. dM 21 | MW, oMo ,MMK. dMMMW: oMMMMd .k' dM 22 | MW, oMo 'NMd kMMMx lxx0X. xN' dM 23 | MW, oMo ;o. .KMMK. :0 0X. lN 24 | MW, oMo ;WMNc :0. cc .d 25 | MW, oMo dMMk :X. : 26 | MW, oMo .. .lNMN:........lWo. ,; .d 27 | MW' oMo ;KddOWMMN000000000XMWOdxXXdd0W 28 | MX. oMo ;MMMMMMMMMMMMMMMMMMMMMMMMMMMMM 29 | Mx dMo ,MMMMMMMMMMMMMMMMMMMMMMMMMMMMM 30 | N, OMo ,MMMMMMMMMMMMMMMMMMMMMMMMMMMMM 31 | M; ,NMo ,MMMMMMMMMMMMMMMMMMMMMMMMMMMMM 32 | Mo dMMo ,MMMMMMMMMMMMMMMMMMMMMMMMMMMMM 33 | Mk.:NMMd..:MMMMMMMMMMMMMMMMMMMMMMMMMMMMM 34 | MN0NMMMN00KMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 35 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 36 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 37 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 38 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 39 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 40 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 41 | -------------------------------------------------------------------------------- /tests/normal.txt: -------------------------------------------------------------------------------- 1 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 2 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 3 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 4 | MMMMMMWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 5 | MMMMWk:';oXMMMMMMMMMMMMMMMMMMMMMMMMMMMWKxl;,''';cdKWMMMMMMMMMMMMMMMMMMMMMMMMMM 6 | MMMMK, .dMMMMMMMMMMMMMMMMMMMMMMMMMMWo. .cKMMMMMMMMMMMMMMMMMMMMMMMMM 7 | MMMMWx;',oXMMMMMMMMMMMMMMMMMMMMMMMMMMN' . ,KMMMMMMMMMMMMMMMMMMMMMMMM 8 | MMMWOllcllxNMMNklllllOKxlc:cldONMMMMMN;;dO0KOo. dMMMM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MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 25 | -------------------------------------------------------------------------------- /tests/flip-xy-invert.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 'odddd: ,cdd, 6 | lWMMMMk. ;OWMMM0, 7 | lWMMMMk. :XMMMMMNo. 8 | lWMMMMk. .kMMMMM0; 9 | .cdxkOOko:cdkOOOkxc. .oxxxxxxxxxxxxxxxc. ,cdkOOOkxoOWMMMMk. .OMMMMMo 10 | ,kKNMMMMMN0do0WMMMMO. ;XMMMMMMMMMMMMMWk. ,0WMMMMMWWWMMMMMMMk. .OMMMMMo 11 | .kMMMMMx. ;XMMMM0' 'xOOOOOOXMMMMMKc. ,KMMMMMKl,';c0MMMMMk. .OMMMMMo 12 | .xMMMMMd.'c0WMMW0; .oXMMMXo. dMMMMMK, lWMMMMk. .OMMMMMo 13 | .xMMMMMXKNWX0xl,. 'OWMMWk' .kMMMMMk. lWMMMMk. .OMMMMMo 14 | .xMMMMMKo:,. .. :KMMMNo. .dMMMMMK; lWMMMMk. .OMMMMMo 15 | dMMMMM0;....,ckXo cNMMMWd ;XMMMMMXd:;cdKMMMMMk. .OMMMMMo 16 | .dXWMMMWXKXNWWXO; ,KMMMMN: . 'o0WMMMMMMWNNMMMMMk. .OMMMMMo 17 | .,clodddoc:,. :NMMMMM0c'..':xx ':lodol;.'lllll, ;lloll' 18 | .kWMMMMMWNXNWMMO .ckOx; 19 | .oXMMMMMMMMMWXc :XMMMk. 20 | .:oxOOOkxl;. .cxOd, 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/normal-clear.txt: -------------------------------------------------------------------------------- 1 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 2 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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M 19 | MMk. 'xNMMMK, lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 20 | MMWk::okNMMMMMNd::::cOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 21 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 22 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 23 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 24 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 25 | -------------------------------------------------------------------------------- /tests/normal-b.txt: -------------------------------------------------------------------------------- 1 | +------------------------------------------------------------------------------+ 2 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 3 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 4 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 5 | |MMMMMMWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 6 | |MMMMWk:';oXMMMMMMMMMMMMMMMMMMMMMMMMMMMWKxl;,''';cdKWMMMMMMMMMMMMMMMMMMMMMMMMMM| 7 | |MMMMK, .dMMMMMMMMMMMMMMMMMMMMMMMMMMWo. .cKMMMMMMMMMMMMMMM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MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 24 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 25 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 26 | +------------------------------------------------------------------------------+ 27 | -------------------------------------------------------------------------------- /src/html.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #include 7 | #include 8 | #include "options.h" 9 | 10 | void print_html_start(const int fontsize, FILE *f) { 11 | 12 | fputs( "\n" 13 | "\n" 15 | "\n" 16 | "\n", f); 17 | fprintf(f, 18 | "%s\n", html_title); 19 | fputs( 20 | "\n" 39 | "\n" 40 | "\n" 41 | "
\n", f);
42 | }
43 | 
44 | void print_html_end(FILE *f) {
45 | 	fputs("
\n
\n\n\n", f); 46 | } 47 | 48 | const char* html_entity(const char ch) { 49 | static char s[2]; 50 | switch ( ch ) { 51 | case ' ': return " "; break; 52 | case '<': return "<"; break; 53 | case '>': return ">"; break; 54 | case '&': return "&"; break; 55 | default: 56 | s[0]=ch; s[1]=0; return s; break; 57 | } 58 | } 59 | 60 | void print_html_char(FILE *f, const char ch, 61 | const int r_fg, const int g_fg, const int b_fg, 62 | const int r_bg, const int g_bg, const int b_bg) 63 | { 64 | if ( colorfill ) { 65 | fprintf(f, "%s", 66 | r_fg, g_fg, b_fg, 67 | r_bg, g_bg, b_bg, 68 | html_entity(ch)); 69 | } else 70 | fprintf(f, "%s", 71 | r_fg, g_fg, b_fg, html_entity(ch)); 72 | } 73 | 74 | void print_html_newline(FILE *f) { 75 | fputs("
", f); 76 | } 77 | -------------------------------------------------------------------------------- /tests/dalsnuten-invert.txt: -------------------------------------------------------------------------------- 1 | ......................................................''''',,,,;;;;:::::cccccl 2 | ............. ..........................''''',,,,;;;;::::cccc 3 | .... ......................''''',,,,;;;;::::ccc 4 | ...................''''',,,,;;;:::::c 5 | ..................'''',,,,;;;;:::: 6 | .................''''',,,,;;;;:: 7 | ..................'''',,,,;;;;; 8 | .................''''',,,,,;; 9 | ................''''',,,,;;; 10 | ................'''',,,;;;; 11 | ..... ...............'''',,,,;;;; 12 | .',;;:clodxxxkkkko:,................'''',,,,;;;;:: 13 | :;'..... ...'... .':ldddxxxkkkOOOOOOO0000000xxdlc;'....'''',,,,;::;;:::c 14 | xxdooolllllloooolloxxkOO00000OO000KKKXXXXXXXXXXXXXXXXNNNXK0KXNNNNN00XNWWNKKXNX 15 | OOkkxxxxxxxxxkkOOOkkO0000KKXXXXXXXXXXXXXXNNNNNNNNNNNWWNNNWWWWWWWWWWWWWMMMMMMMM 16 | K000OOOOOOOO0000KKKKK0KKXXXXXXNNNNNNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMM 17 | KKKK00000000KKKKXXXXXXXXXXNNNNNNWWNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMM 18 | XXK00K0OOOOOOO0000KKKK000000KNWWWWWKXNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW 19 | XK0OOko:;;;;;;colcddddddddddxNWWWWNNKKXXNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMWMMW 20 | NXKOxl;. .,;;lOOkOXXK00KXXNXNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMWWMMM 21 | KOkxxc. .;cx00KXXNNNNNNWNWWWNNNWWWWWWWWWWWWWWMWWWWWWWWWWWWWWWWMMMMMMMMMMMMMM 22 | XXKOkdc::ldxkO0KXXNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMM 23 | XXXK0OOOO000KKKKXXXNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMM 24 | NNNXXXKKXXXXXXNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMM 25 | WWNNNNNNNNNNNNWWNWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 26 | WWWWWWWNNWWWWWNWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 27 | MWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 28 | WWWWWWWWWWWWMMMWWMMMMMMMMMMMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 29 | WWWWMWWWMMMMMMMMMMMMMMMMMMMWWMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 30 | -------------------------------------------------------------------------------- /tests/dalsnuten-normal.txt: -------------------------------------------------------------------------------- 1 | KKKKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXKKKKKKKKK000000OOOOOkkkkxxxxdddddoooool 2 | XXXXXXXXXXXXXNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXKKKKKKK000000OOOOOkkkkxxxxddddoooo 3 | XXXXNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXKKKKKKK00000OOOOOkkkkxxxxddddooo 4 | NNNNNNNNNNWWWWWWWWWWWWWNNNNNNNNNNNNNNNNNNXXXXXXXXKKKKKK00000OOOOOkkkkxxxdddddo 5 | NNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNNNNNNNNNNNNXXXXXXXKKKKKK00000OOOOkkkkxxxxdddd 6 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNNNNNNNNNXXXXXXKKKKKK00000OOOOOkkkkxxxxdd 7 | WWWWMMMMMMMMMMMMMMMWWMMWWWWWWWWWWWWWWWNNNNNNNNNXXXXXXXKKKKK000000OOOOkkkkxxxxx 8 | WMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWWWNNNNNNNNNXXXXXXKKKKKK00000OOOOOkkkkkxx 9 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWNNNNNNNNXXXXXXKKKKK00000OOOOOkkkkxxx 10 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWNNNNNNNNXXXXXXKKKKK00000OOOOkkkxxxx 11 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWNXK00KNNNNNNNXXXXXXKKKKK0000OOOOkkkkxxxx 12 | MMMMMMMMMMMMMMMMMMMMMMMMMMMWKOkxxdolc:;;;,,,,cdk0XXXXXKKKKKK0000OOOOkkkkxxxxdd 13 | dxO00KKXNNNNNNXK0O0KXNNXOdl:::;;;,,,'''''''.......;;:loxO0000OOOOkkkkxddxxdddo 14 | ;;:cccllllllccccllc;;,''.....''...................... ..... ... ... . 15 | '',,;;;;;;;;;,,''',,'.................... 16 | ....''''''''.................. 17 | .......................... 18 | .......'''''''............... .. 19 | ...'',cdxxxxxxoclo::::::::::; .... 20 | ..';lxXM0kxxl'','........ . 21 | .',;;oKWMN0xo;..... 22 | ...',:oddl:;,'.... 23 | .....''''.......... 24 | ........... 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/grind.txt: -------------------------------------------------------------------------------- 1 | OOO00kxOdd:::... 2 | OKKXKOxOkkxdolc; 3 | kOKXXXK00Okxxxo;. . 4 | XXXXXNK000OOkxl,. 5 | NXXXXKxk00Okkxl:. 6 | XXKKKXOx0oxkkodl:'... ... 7 | 0KNXKXOlOkOolcoxoll:,.............................. 8 | 0KXXXXKK0KOxxxkdc,,..................................... ................ 9 | OO0KXN00O0xkxdlc,.....'',.''..,:c:;,;:cc:;,''''';,''',,.........;;,,'...''',,;;: 10 | KK0k0XOOOk:;;;;'',''''';;;::,;loolcclooooc;,,,::::;;;:,'........,;;,,...'''',,,, 11 | OkOxkNOdko:'',,;;;;;;:lllcc:;:loollccccc:;;;;;c:;;;,,,''......'..''..'''''',,,;; 12 | XK0O0X0ddxxc;;:c::::lddolc::c:::;:;:;;;;;;;;;,l,,',,,,,,''''',,;;;;;;;;;:;;;;;:: 13 | KKK00XK0kOkkOOddl:;;;:::::ccc:;;;;;;;,;,,;;;,:l;;;;,;;;,,,,;;::::;;::::::ccccccc 14 | 00OOxxxdxdxdoodoolloc'......;collc:;;,,,;,,;;l;',,,,;;::;;,;:;;;;;;;::cc::cccllc 15 | OXKXkoddolododxxooddd:.......',:oool:;;;c;,,;l;,;,,,,,;;;;;::::::::cccccclccllll 16 | OKXKOkddolxxccOdoxxo;. .x. .O'.,oddllc:c::c:o;,;;;::::;:ccc:cc::::ccllccloodooo 17 | XOOXK0KXxoOOxx0xoxxl,:Ok.x. .Ool,;oOkdodoc:oodccc:ccc::::ccccccllooololloooldddo 18 | N00XN0KX0O00kk00O00xdddxooolokkkooxkxxkOxlldxkxl:::;;c:;;:::::llllloddooollloood 19 | WK0XN00XxxOOdx0OKK0o:;X0,OO0O00Oc:o0lxOOxxkOOO0K0kxllkodoolcoooxOkddkoddoxkkkxO0 20 | NK0XNKKX00KK00K0KOOd000OOOOOOkkkdodkdxOKKK0O0OOXkkxxO0KOddxdxddOOk00OOxkk00KNKXN 21 | WK0XNXKXKXNNXKKOdx0:;:KO;xo:::xkOOOOddk00OOO0OONNNNXXNK0OkkkkOK0OO00XX0kOXNNNXNN 22 | WN0XNNNNNXXKOOKOddOc;:0O,xc...dk;:xKkox0OokkkkOWXKXXXKK00KKKXXXKkxO00KNKXXNXXNXX 23 | WXXNWWWWK0K0xd00oo0olo0OdkxoddkkxxxOOO00OoxxkOKKddk0KOKXXNNNNNXXKO0KKXNNWNNNNKXX 24 | MNNWWNNNKKKko;,,.,:...cc';,...ox;,,;:cd0kddx0KX0kkOXXXXXXXKXXNNX00O0OkkkOOO000kk 25 | WWNNNNNXKOdllc::::c::;;,;,,;c::cld::cldxkkkONWWWWWNNNNNNXXXXXXXXKXKXXkxddxxxxxkx 26 | NXKKXXXK0Odlccc:::;::::::::dxkxONKKxllllodddxkOOOOkOO0KKXXNNXX00KNXNNXOO0K0Oxddd 27 | NNNNXXKkoccc:::::;::;;:::::kkOKKNXXOcccccccclcllllllooodxO0KX0000KXXKKKXNXXKkddo 28 | NNXXK00Odl::;;;;;;;;;;;;;:ck00NWOc::;:;;;::::cccc:ccccookOkxxOOkxxkddooddddddodd 29 | XXXXXK0dlc;,,,,,,,,;;;::cclodd0Wd::;,,;,,,;;::::::cccclclodoooxkkkkOkxddoxdodddo 30 | XKKKX0xlc:;;,,;,,,;;;::;::clllodc:;;,,;;;,;;;::c:::::ccc::clllokOkOkxxxoooollddd 31 | -------------------------------------------------------------------------------- /tests/grind-blue.txt: -------------------------------------------------------------------------------- 1 | K0KKK00KOkllo';, 2 | 0XXNXKOK00OOkxdl. 3 | O0XNNNXKXK00OOkc' . 4 | WWWNWNNXNX0K00x:. .. 5 | WWWNNXKKXXKKK0ko,. 6 | NNNNNNKOKx0K0kOko;''. 7 | NNWNXNXxK0KxxdxOkdoc;'...................................... 8 | NWWNNNXNXNK0000Oo;'...................''........''..............,;;;,........... 9 | XXNNNWXX0Kk0Okol:.....',:,,;'';col;,:loolc,,',,;lc;,;cc,',,'''':doodo;,,,,,;;;;c 10 | XNNXXNKX0O:;:;;,',,,,,,cccll::dxddoodxxddo:;;,clllc:cl:;;,,,,,,;cllll;;;;;;;;;;: 11 | K0K0KW0Okdc,,,;;;;;;;ldxdllc::oddlllccllc:::::occ::::::::::::::::ccccclllllllloo 12 | NXKKXXKOO0Ooc:cc::::oxxdolccccllclcllooloooodoxdooooddoddooodddxxxkxxkkkkxxxxxxx 13 | XXXKXWXXXXXXXK00koooloodddxxxdddddddddxxxxkkxkOkxxxxkxxxxxxkOOOOOkkkkkkkkOOOOkkO 14 | KKK0kOkkO0KKKXKKKKKKk:.....':xOkkkxxdoddxxkkkOkxxxxkkkOOkkkOOOOkxkkOOOOOkOOOOOO0 15 | 0XKXOxkkxdxkOKKKXKKXKd...'...';lO00OkxdoxdxxxOxkkxxkkxkOOOO00000000KKKK0KKKKKKKK 16 | OKNX0OxkddOkodKOKOO0l'...k'..O'.:O00OOkxxdxkk0kkkkkOOkOO0K0K0KK00O000KKKKKXKK0KO 17 | NO0XXKXXkx00OOKkOOkx;c0k'x' .Ooo;ck0K0OOOkxkk00OOOOOOxxxkOO00KKKKXXXKX00KXXKKKOk 18 | N00NNKXXKKK0Ok0K00KxdddxooolokkkooxkOOOOOkOxkkkoccddodxddxxxxdK0kkk0XKXKKKKKXKK0 19 | WK0XNXNNXXXKXKK0XK0d:;NK;O0K0K00c:d0lk00O00O0O0K0kkookddoolcoodx0kddOdxkxkOOO0O0 20 | NKKXNXXXKXXKKKK0K0Ox0000OOOOOkkkdodkdk0KXNKO0O0Nkkxx0KKOxdxxkddOOx0OkOxxkOOKN0XN 21 | NX0XNNXNNWNNWNX0kx0::cK0:kocccxk0OOOxdk0KK0O0OONNNNNNNXK0kkOk0X0Ok00XXOkOXNNNKXN 22 | WN0XNNNNNXXKKKK0xdOc:cKO;xl'''xO:ckKkdxKOdkkOkONXKXNNNXKKKKKXNNKOO0OOKN0KXNXXXKX 23 | WXXNWWWWNWWXOxK0dd0dod00dkkddxkkxxkOOOO0OdxxkOKXddk0K0XNNWWNNNNNNNXK0KNNNNNXXKKX 24 | MNWMWWWWNNX0kc;;,;c,',ol,::'''dx:;::clx0OxdxKXX0kk0NNNNWWNNNNWWWNWXXKkxkkOO000OO 25 | MWWWWWWWN0dlcc::::c::;;;;;;:c::cld::cloxkkkONWWWWWWNWWWWWWWWWNNNNWNWW0kdxkkkkkkk 26 | WWNNWWNXK0xlc::::;;;:;:::::dkOxONK0xlcllloodxkkOOkkk00XXNNWWWWXKNWWWWNK0KNX0xddd 27 | WWWWWNX0dccc::::;;;:;;:::::kkO0KNXXOc:::::ccccccclccllodkKXXNXK0KXXXX0KXNNNXkdoo 28 | MWWWNXK0xl::;;;;;;;;;;;:::ckO0NWOc::;;;;;:::::::c:::ccloOKOxOKXOxkkdooloooooolod 29 | WWWWWWKxcc:;,,;;;,;;;;::cclodd0Nd::;,;;;,;;;::::::::cccccoddodkO0O00Oxddoxdollol 30 | WWWWWKxlcc;;;;;;;;;;:::;::clllodl::;;,;;;,;;;::c:::::ccc::ccloxKK0K0xxxllolllooo 31 | -------------------------------------------------------------------------------- /tests/grind-green.txt: -------------------------------------------------------------------------------- 1 | OkO0Okxkdo:;:... 2 | k0KK0Oxkkxdolcc; 3 | xkKKKXKO0Oxxddo,. . 4 | XXXXXXK000kkxdc'. 5 | NXKKKKxkO0kkxdl;. 6 | KK00KXkxOlxkxool;.... 7 | OKXK0XOlkxOolcldoll:,........... ................... 8 | 0KKXKX0000kdxxxoc,'....................................... ................ 9 | OOO0KN00k0dxdoc:,.......'..'..,;::,,,:c:;;'''''';,''',,........';;;;,'.'''',,,;: 10 | K00kOXOOkk:,,,,'''''''',;;;:,,looccclloolc,,,,::;:;;;:;''.......,;;;,...'''',,,, 11 | 0kOxkNOdxo:''',,,;,,,:lll:::;:cooccc::cc:;;;;;l::;;,,,''.''..'''.''...'.'''',,,, 12 | XK00KX0ddxd:;;;:::;:cdoll::::::;;:;;;;;,,,,,,'c,'''',''''''''',,,,,,,,,,;,,,,,;; 13 | KKK00XK0kkkkkOddl:;;;:::::c::;,;;;,;;',''',,';c,'''',,,'''',,,;,,,,;;;;;;;;::::: 14 | 00OOxxxxxddoclolcccc:'.....';clcc:;;,',',.'''c,..'.''';,,,',,,,',,,,;;:c:;;::cc: 15 | OXKXkoddolodloddllloo:.......',:lllc:;;;:,'',c,''''''',,,,,,,,;,;;;;;;:;:::::::: 16 | OKXKOkddolxxlcOdlddo;.. .x' .O'.,llolc:;:;;:,l'''',;;;;,,;:;;;;;,;;;;:c:::cclcll 17 | NOOXK0KKxoOOkx0klxdc,:0k.x. .Ool,;oOxoodoc;loo::;;::::::;:::::;:cllcclccccc:lool 18 | N00XNO0XOk00kk00k00xdddxooolokkkooxkxxkOxccdxkxl:::;;c;;;::;;:ccclllollccc::ccld 19 | WK0XNOOXxokOod0O0K0o:;NK,O00O00Oc:o0ldOOxdxOKO0K0kkllkodoolcoooxOkdxkoddoxkxxdO0 20 | NK0XNKKX00KK00K0KOOx000OOOOOOkkkdodkdxOKKK0O0OOXkkxxO0KOxdxdxddOOk00OOkkk00KNKXN 21 | WK0XNXKNKKNNK0KOdx0:;:K0:ko:::xkOOOOddk00OOO0OONNNNXXXK0OkkkkOK0OO00XX0kOXNNNXNN 22 | WN0XNNXNNXXKOk0OddOc::0O,xl'..dO::xKkox0OokxkkOWXKXXX0K00KKKXXXKkdO00KNKXXNXXNXX 23 | WXXNWNNWKOK0dd00od0olo0OdkxdddkkxxkOOO00OdxxkOKKddk00O0KXNNXNNKK0kO0KXNNWNNNNKXX 24 | WNNWNXXXK00kl;,,',:'.'lc':;...ox;,;;clx0kddx00K0kkOKXKXXKKKKKXXXOOkOkxkkOOO000kO 25 | NNNNXXXK0Odolc::::c:::;;;;;:c:ccld::cldxkkkOXNNWWNNXXXXXKKKKKKXK00OKKxxddxxxkkkk 26 | XKKKKKK0OOdlccc:::;::::::ccdkOxONKKxllllodddxkkOOkkkOOKKKKXXK000KNXXNKOk000kxddx 27 | XXXXKK0kollc::::::::::::c::kk0KXNXXOcccccccclcllllllooodxOO0K0OO0KKKK0KKXXXKkddo 28 | XXKK00Okdlc:;;;;;;;;;;;:::ck00NWOcc:::::::cc:cccc:ccccooxkkdxkkxxxxddooddddddodd 29 | KKKKK0Odlc:;,,;;;,;;;;::cclodd0Wd::;,;;;,;;;::::::cccclclloooodxxxkkkxddoxdooddo 30 | K00KK0xlcc;;;;;;;,;;:::;ccclloodl::;,,;;;,;;;::c:::::ccc::clllokkkOkdxxoooollddd 31 | -------------------------------------------------------------------------------- /tests/grind-red.txt: -------------------------------------------------------------------------------- 1 | OO000kxOdo;;:... 2 | kKXXX0kOOkxdolc; 3 | xkKXXXK0K0kkxxo,. 4 | NNNNXNK0KKOOkxc' 5 | NNXXXKxk00Okkxl;. 6 | NNXKKXkdOlxkkooc;'.............. 7 | 0XNXKXOcOkOoc:lxoolc;'........................... 8 | 0XXNNNKK0KOxxkkxl;;'''................''..'.......... ...... 9 | kO0KXN0KO0kkxxoc;'''.''',.''.',:cc;,;:cc:;,''''',,....... ...........'',,;: 10 | 000k0XO0Ok:;;;:,,;,,,'';;;::;;oddllloooooc;,,,::;:;,,;'... ......''.........'',, 11 | kkOdxNkdkdc,,,;:::::;coooccc:clddllccclc:;;;;,:;;,,'''......................'''' 12 | KKOO0KOddkdc;:cccc:clxdolc:::::;;:;;;;;,,,,,,,c,'''','........',,,,,,;;;;;,,,,;; 13 | K0KOkXK0kOOkkkddl:;;;:::;:c::;',,,,;;,,,,;;;,:c;,,,,,,,,,,,,;::::;;:::;::cccc::c 14 | 0OOkoddddoxdloooooooc' ...,clcc:;,,',',',;,c;'''',,;:;;,,;;;;,,;;;::cc:::ccllc 15 | OKKXdlodlclolxkxdddxx: . .';odoc;;,,:,,',c,,,'',,';;;;;:::c::ccclllcllllloll 16 | kKXKkxoolcxxc:Odoxdo,. x. .k..'odolc:;:;;:;l;,,,;::;:;:ccccccc::ccclollodododo 17 | XOOX00XXdokkdd0xoxdl';kd.x. .klc';oOkdool::lodlcc:cc:;;;::ccclllodddoollodoldxdo 18 | N00XN0KX0O00kk00kO0xdddxloolokxklldxxxxkd:cdxkxc;;;;,:;',:;;;;olllldxddooollooox 19 | WK0KNO0XxxOOxx0O0K0l;,XO'kOOO0OO:;o0lxOOxdxkdk0K0kxclkodllc:ooodOkddklddoxkkkxO0 20 | NK0KNKKX00KK00K0KOOdOOOOOOkkOkkkdodkdxOK0KOOOOOXkkxdO0KOdoxdxddOOk00OOxkO00KNKXN 21 | WK0XNX0XKXNNXKKkddO;,;0k,xl;;;dkOOOOddk0000O0O0NNNNXXNK0kxkkkOK0OO00XX0kOXNNWXNN 22 | WN0XWNNNNNXK0OKOooO:,;Ox.d:...dk,,xKkld0koxxkkOWXKXXXKK00K0KXXXKOxO00KWKXXNXXNXX 23 | MXXWWWWWKKX0xoOOlo0lclOOoxxoodxkxdxkOOO0koxxkOKXdxk0K0KXNNNNNNXNXK0KKXNNWXNNNXXX 24 | MNWMWWWNXXKOo,....;...:;.,'...ld'.'';:d0kddkKXN0kk0XNNNNWNXXXNNNKX0K0OOOOOOO0Oxk 25 | WWWWWWWNX0dlcc:;;;::;;,,,,,;;;::co;;:ldkkkk0NWWWWWWNWWWWNNNNNXNXXNXNNkxoddddxxxx 26 | WNXXNNNX0Odcc::::;;::::::::odxdkN00xlllloddxkOO00OOO0KXXNNWWWNKKXWNWWN0OKK0kdddd 27 | WWWWNNKOocc:::::;;;;;;;:::;kkO0KXXXkc::c:ccclcllllllooddk0XXNXK0KXXXXKXXNNNKkddo 28 | WWNNXKKOdc:;;,,;,,,,;,,;;::kO0NWOc:;;;;;;:::::::c::cclodO0OxkO0kxkkxdddddxxxxodo 29 | NNNNNX0dc:;,'',,,',,,;:::cloodOWo;;,',;,',,;;;::::::cclclodooodkOkOOOxxdoxddddxd 30 | NXXXNKdlc:,,,,,,,,,;;;:;::clllodc;;,'',,,',;;::::::::ccc::ccclokOkOOxxxoodoooddd 31 | -------------------------------------------------------------------------------- /src/jp2a.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #ifdef HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | 10 | #ifdef HAVE_UNISTD_H 11 | #include 12 | #endif 13 | 14 | #include 15 | 16 | #ifdef HAVE_STRING_H 17 | #include 18 | #endif 19 | 20 | #include "jp2a.h" 21 | #include "options.h" 22 | 23 | #ifdef WIN32 24 | #ifdef FEAT_CURL 25 | #include 26 | #define close _close 27 | #endif 28 | #include 29 | #endif 30 | 31 | int main(int argc, char** argv) { 32 | int store_width, store_height, store_autow, store_autoh; 33 | FILE *fout = stdout; 34 | #ifdef FEAT_CURL 35 | FILE *fr; 36 | int fd; 37 | #endif 38 | FILE *fp; 39 | int n; 40 | 41 | parse_options(argc, argv); 42 | 43 | store_width = width; 44 | store_height = height; 45 | store_autow = auto_width; 46 | store_autoh = auto_height; 47 | 48 | if ( strcmp(fileout, "-") ) { 49 | if ( (fout = fopen(fileout, "wb")) == NULL ) { 50 | fprintf(stderr, "Could not open '%s' for writing.\n", fileout); 51 | return 1; 52 | } 53 | } 54 | 55 | for ( n=1; n 11 | 12 | #ifdef HAVE_STRING_H 13 | #include 14 | #endif 15 | 16 | #ifdef HAVE_STDLIB_H 17 | #include 18 | #endif 19 | 20 | #ifdef HAVE_CURSES_H 21 | #include 22 | #endif 23 | 24 | #ifdef FEAT_TERMLIB 25 | #ifdef HAVE_TERM_H 26 | #include 27 | #else 28 | #ifdef HAVE_NCURSES_TERM_H 29 | #include 30 | #endif 31 | #endif 32 | 33 | #ifdef WIN32 34 | #define WIN32_LEAN_AND_MEAN 35 | #include 36 | #endif 37 | #endif 38 | 39 | /* 40 | * Returns: 1 success 41 | * 0 terminal type not defined 42 | * -1 termcap database inaccessible 43 | * -2 environment variable TERM not set 44 | */ 45 | int get_termsize(int* _width, int* _height, char** err) { 46 | static char errstr[1024]; 47 | 48 | #ifndef WIN32 49 | char *termtype = getenv("TERM"); 50 | char term_buffer[2048]; 51 | int i; 52 | #endif 53 | 54 | errstr[0] = 0; 55 | 56 | if ( err != NULL ) 57 | *err = errstr; 58 | 59 | #ifdef FEAT_TERMLIB 60 | 61 | #ifdef WIN32 62 | CONSOLE_SCREEN_BUFFER_INFO io; 63 | if ( !GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &io) ) { 64 | strcpy(errstr, "Could not determine console window size."); 65 | return -1; 66 | } 67 | *_width = io.srWindow.Right - io.srWindow.Left; 68 | *_height = io.srWindow.Bottom - io.srWindow.Top; 69 | return 1; 70 | #else 71 | 72 | if ( !termtype ) { 73 | strcpy(errstr, "Environment variable TERM not set."); 74 | return -2; 75 | } 76 | 77 | i = tgetent(term_buffer, termtype); 78 | 79 | // There seems to be some confusion regarding the tgetent return 80 | // values. The following two values should be swapped, according 81 | // to the man-pages, but on Mac OS X at least, they are like this. 82 | // I've also seen some indication of a bug in curses on USENET, so 83 | // I leave this one like this. 84 | 85 | if ( i == 0 ) { 86 | snprintf(errstr, sizeof(errstr)/sizeof(char) - 1, 87 | "Terminal type '%s' not recognized.", termtype); 88 | return 0; 89 | } 90 | 91 | if ( i < 0 ) { 92 | strcpy(errstr, "Could not access the termcap database."); 93 | return -1; 94 | } 95 | 96 | *_width = tgetnum("co"); 97 | *_height = tgetnum("li"); 98 | 99 | return 1; 100 | 101 | #endif // non-WIN32 102 | 103 | #else 104 | strcpy(errstr, "Compiled without termlib support."); 105 | return 0; 106 | 107 | #endif // FEAT_TERMLIB 108 | } 109 | -------------------------------------------------------------------------------- /tests/logo-30.txt: -------------------------------------------------------------------------------- 1 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 2 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 3 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 4 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 5 | MMMMMMX00OOXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNXKOOOOO00KNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 6 | MMMWXXd''..l0NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWN0xxl;,.....'';cxKKNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 7 | MMMNKKc ;kXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMKd;.. .,,xWWMMMMMMMMMMMMMMMMMMMMMMMMMMMM 8 | MMMWXXx::;;dKNMMWWNXXXXXNWMMNXKKKKXNWWMMMMMMMk:. .',;;'. ;OXMMMMMMMMWNXXKKKKKXXNWMMMMMMM 9 | MMMKxxl,,,,co0MNXXx;;;;;:lddl;,,,,;cooOXWMMMM0olllx0KXX0k; ,dKMMMMXOOxlc;;,,,,,;;clkXXNMMM 10 | MMMO::. .'xMN00: ... ..c0XMMMMXk0XXWMMMMMWo ,dKMMMWOll' :kkXMMM 11 | MMMOcc. .'xMN00: ':kWWWMNXNWWWMMMMMMo.. ,kKMMWNd... ..... .::kWMM 12 | MMMOcc. .,xMN00: .,,;c;''. ;OOXMMMMMMMMMMMWNl lXWMMNXl..':ldxkkoc. lNWM 13 | MMMOcc. .,xMN00: :KKXWX00c. .ccOMMMMMMMMMMM0o' .ccOMMMMWN0xx0NNNKOOxl. cXNM 14 | MMMOcc. .,xMN00: lWWMMMMMx'. .,,kMMMMMMMMX00c. ..oXXWMMMMMMWNN0xl:,..... cXNM 15 | MMMOcc. .,xMN00: lWWWMMMMk,. .,,xMMMMMMMM0oo' .cOMMMMMMMMMN00l'. .'. cXNM 16 | MMMOcc. .,xMN00: lWWWMMMMd.. .;;kMMMMMMNKo''. ;x0NNNNWMMWWk::'. .::ld, cXWM 17 | MMMOcc. .,xMN00: ,xxk0kxx; ,ddKMMMWNNx;. ..'ccccccxXXK0: .lNNXK: :0XW 18 | MMMOcc. .,xMN00: ...'... .oXXWMWNkcc. ;OOO0; ,ooc;. .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MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 31 | -------------------------------------------------------------------------------- /src/curl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 Christian Stigen Larsen 3 | * Distributed under the GNU General Public License (GPL) v2. 4 | */ 5 | 6 | #ifdef HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | 10 | #ifdef FEAT_CURL 11 | 12 | #ifdef WIN32 13 | #include 14 | #include 15 | #endif 16 | 17 | #include 18 | 19 | #ifdef HAVE_CURL_CURL_H 20 | #include "curl/curl.h" 21 | #endif 22 | 23 | #ifdef HAVE_STDLIB_H 24 | #include 25 | #endif 26 | 27 | #ifdef HAVE_STRING_H 28 | #include 29 | #endif 30 | 31 | #ifdef HAVE_UNISTD_H 32 | #include 33 | #endif 34 | 35 | #ifdef WIN32 36 | #include 37 | #include 38 | #define close _close 39 | #define pipe(x) _pipe(x, 256, O_BINARY) 40 | #endif 41 | 42 | // local variables to curl.c 43 | int fd[2], debugopt; 44 | const char* URL; 45 | 46 | //! Return 1 if s is a supported URL 47 | int is_url(const char* s) { 48 | return !strncmp(s, "ftp://", 6) 49 | | !strncmp(s, "ftps://", 7) 50 | | !strncmp(s, "file://", 7) 51 | | !strncmp(s, "http://", 7) 52 | | !strncmp(s, "tftp://", 7) 53 | | !strncmp(s, "https://", 8); 54 | } 55 | 56 | #ifdef WIN32 57 | size_t passthru_write(void *buffer, size_t size, size_t nmemb, void *userp) { 58 | FILE *f = (FILE*) userp; 59 | return f!=NULL? fwrite(buffer, size, nmemb, f) : 0; 60 | } 61 | #endif 62 | 63 | #ifndef WIN32 64 | void curl_download_child() 65 | #else 66 | void curl_download_child(void*) 67 | #endif 68 | { 69 | FILE *fw; 70 | CURL *curl; 71 | #ifndef WIN32 72 | close(fd[0]); // close read-end 73 | #endif 74 | 75 | if ( (fw = fdopen(fd[1], "wb")) == NULL ) { 76 | fputs("Could not open pipe for writing.\n", stderr); 77 | exit(1); 78 | } 79 | 80 | curl_global_init(CURL_GLOBAL_ALL); 81 | 82 | curl = curl_easy_init(); 83 | curl_easy_setopt(curl, CURLOPT_URL, URL); 84 | 85 | if ( debugopt ) 86 | curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); 87 | 88 | curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); // fail silently 89 | curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); // redirects 90 | curl_easy_setopt(curl, CURLOPT_WRITEDATA, fw); 91 | #ifdef WIN32 92 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, passthru_write); 93 | #endif 94 | 95 | curl_easy_perform(curl); 96 | curl_easy_cleanup(curl); 97 | 98 | fclose(fw); 99 | close(fd[1]); // close write-end 100 | 101 | curl_global_cleanup(); 102 | 103 | #ifdef WIN32 104 | _endthread(); 105 | #endif 106 | } 107 | 108 | // Return read-only file-descriptor that must be closed. 109 | int curl_download(const char* url, const int debug) { 110 | #ifndef WIN32 111 | int pid; 112 | #endif 113 | 114 | URL = url; 115 | debugopt = debug; 116 | 117 | if ( pipe(fd) != 0 ) { 118 | fputs("Could not create pipe\n", stderr); 119 | exit(1); 120 | } 121 | 122 | #ifndef WIN32 123 | 124 | if ( (pid = fork()) == 0 ) { 125 | // CHILD process 126 | curl_download_child(); 127 | exit(0); 128 | } else if ( pid < 0 ) { 129 | fputs("Could not fork.\n", stderr); 130 | exit(1); 131 | } 132 | 133 | #else 134 | if ( _beginthread(curl_download_child, 0, NULL) <= 0 ) { 135 | fputs("Could not create thread", stderr); 136 | exit(1); 137 | } 138 | #endif 139 | 140 | // PARENT process 141 | 142 | #ifndef WIN32 143 | close(fd[1]); // close write end of pipe 144 | #endif 145 | 146 | return fd[0]; 147 | } 148 | 149 | #endif 150 | -------------------------------------------------------------------------------- /tests/110x30-i-b.txt: -------------------------------------------------------------------------------- 1 | +--------------------------------------------------------------------------------------------------------------+ 2 | | | 3 | | | 4 | | | 5 | | | 6 | | | 7 | | ,ldOxdc. .;clxkOOOOOxol:. | 8 | | .kMMMMMN: .lx0WMMMMMMMMMMMMW0d; | 9 | | .dNWMWW0, lWMMMMMMMMMMMMMMMMMMX: | 10 | | ':colc,. ....... ....... oMMN0kxoood0NWMMMMMMMK, .......... | 11 | | cKKKKKKKd;. .oKKKKKKKxcoO0KNNNNK0Od:'. :o:, .'dWMMMMMMN: ..,ldxOKKXNNNNNXX0xdc. | 12 | | .oMMMMMMMO:. .kMMMMMMMMMMMMMMMMMMMMMWXx. ;XMMMMMMX; lXNMMMMMMMMMMMMMMMMMWk:. | 13 | | .oMMMMMMMO:. .kMMMMMMMMWN0OO0NWMMMMMMMWx;. cNMMMMMMx. dMMWX0xolcclokNMMMMMMWXl | 14 | | .oMMMMMMMO:. .kMMMMMMWx;' ';xWMMMMMMWNl 'o0MMMMWWk. :ko,.. .,OMMMMMMMMd | 15 | | .oMMMMMMMO:. .kMMMMMMWl '0MMMMMMMMx. .kWMMMMM0l' ..,lxkKWMMMMMMMMx. | 16 | | .oMMMMMMMO:. .kMMMMMMWl .kMMMMMMMMk. 'lkWMMMWNO' .,:lx0KXWNXKXMMMMMMMMx. | 17 | | .oMMMMMMMO:. .kMMMMMMWl ,KMMMMMMMWd .oXMMMMMXo,. ;d0WMMMWW0c'..dMMMMMMMMx. | 18 | | .oMMMMMMMO:. .kMMMMMMMx;. 'cOMMMMMMMNK: .cOWMMMMMMKxodddddddl. 'OMMMMMMXO; dMMMMMMMMd | 19 | | .oMMMMMMMO:. .kMMMMMMMWXKkxxkKNWMMMMMMWd,. .;0WWMMMMMMMMMMMMMMMMMX; ,KMMMMMMNKo.',c0MMMMMMMMKl::.| 20 | | .oMMMMMMMO:. .kMMMMMMMWWWMMMMMMMMMMWOd:. ,kXNMMMMMMMMMMMMMMMMMMMMX; .oKNMMMMMMWNNWNXXWMMMMMMMMXO;| 21 | | .oMMMMMMMO:. .kMMMMMMWkco0XNNNNNX0kc. 'x0OOOOOOOOOOOOOOOOOOOOOOk' ..cOXXNNNNXko:,,dXNNNNXKx:,.| 22 | | .,xMMMMMMMk:. .kMMMMMMWl ..'''''... ......................... ..'''''.. ..'''''. | 23 | | ;kXNMMMMMMWd. .kMMMMMMWl | 24 | | oNMMMMMMWNk. .kMMMMMMWl | 25 | | .kMMMMMNd;. .kMMMMMMWl | 26 | | ,oddoc, :ddddddo' | 27 | | | 28 | | | 29 | | | 30 | | | 31 | | | 32 | +--------------------------------------------------------------------------------------------------------------+ 33 | -------------------------------------------------------------------------------- /tests/dalsnuten-80x49-inv.txt: -------------------------------------------------------------------------------- 1 | .......................................................''''',,,,;;;;;::::cccccll 2 | ............... ............................'''''',,,,,;;;;::::ccccc 3 | ............. ..........................'''''',,,,;;;;::::cccc 4 | ....... ........................''''',,,,,;;;;::::ccc 5 | ... ......................''''',,,,;;;;:::::cc 6 | ....................''''',,,,,;;;:::::c 7 | ...................'''',,,,;;;;::::: 8 | ...................'''',,,,;;;;:::: 9 | .................''''',,,,;;;;::: 10 | .................''''',,,,;;;;:: 11 | ...................'''',,,,;;;;: 12 | ..................''''',,,,;;;; 13 | .................''''',,,,,;;; 14 | ................'''''',,,,,;; 15 | .................''''',,,,;;; 16 | .................'''',,,;;;; 17 | ...............''''',,,;;;; 18 | ................'''',,,,;;;; 19 | ..';cldoo:. ................'''',,,,;;;;: 20 | .,ccloddxxxxkkkkkko;................''''',,,,;;;;:: 21 | .. .;odddxxxxkkkkOOOOOOOOOOxl:;..........'''',,,,;;;;;::: 22 | dolc:;,'.......';:c:,...;odxxxxxkkkkOOO00000000000000K0Odc,..'';;,;,,,;lllc:::cc 23 | xddoollcccclooolcloddxkOOOOOOOOOO0KKKKXXXXXXXXXXXXXXXXXXXXX0OXXNNNNXOOXNWNN00KNK 24 | kkxxdddoooooddxxxddkkkkO0KKKKKKKKKKKKXXXXXXXXXXNNNNNNNNNNNNNNNNWWWWWWWWWWWWWWWMW 25 | OOkkxxxxxxxxxkkOOOOkO00000KXXXXXXXX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OO00K0KKKXNNNNNWWWWWWWWWWWWWWWWMMMMWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMM 39 | NXXK000O0000KKXXXXXNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMWMMMMMMMMMMMMMM 40 | NXNXXKKKKKKXXXNNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 41 | NNNNNXXXXXXXXNNNNNWWWWNNWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 42 | WWNNNNNNNNNNNNWWNWWNNWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 43 | WWWNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWMMMWWMMMMMMMMMMWWWWMMMMMMMMMMMMMMMMMMMMMMM 44 | WWWWWWWNNWWWWWNWWWWWWWWWWWWWWWWWMWMMMMMMMMMMMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 45 | MWWWWWWWWWWNNNWWWWWWWWWWWWWMMMMMMMMMMMMMMMMWMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW 46 | MWWWWWWWWWWWWWWWWWWMMMWMMMMMMMMMMMMMMWWMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 47 | WWWWWWWWWWWWWMMMWWMMMMMMMMMMMMMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWM 48 | WWWWMWWWMMMWMMMMMMMMMMMMMMMMMWMWMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 49 | WWWWMMMMMMMMMMMMMMMMMMMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 50 | -------------------------------------------------------------------------------- /tests/dalsnuten-color.txt: -------------------------------------------------------------------------------- 1 | KKKKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXKKKKKKKKK000000OOOOOkkkkxxxxdddddoooool 2 | XXXXXXXXXXXXXNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXKKKKKKK000000OOOOOkkkkxxxxddddoooo 3 | XXXXNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXKKKKKKK00000OOOOOkkkkxxxxddddooo 4 | NNNNNNNNNNWWWWWWWWWWWWWNNNNNNNNNNNNNNNNNNXXXXXXXXKKKKKK00000OOOOOkkkkxxxdddddo 5 | NNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNNNNNNNNNNNNXXXXXXXKKKKKK00000OOOOkkkkxxxxdddd 6 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNNNNNNNNNXXXXXXKKKKKK00000OOOOOkkkkxxxxdd 7 | WWWWMMMMMMMMMMMMMMMWWMMWWWWWWWWWWWWWWWNNNNNNNNNXXXXXXXKKKKK000000OOOOkkkkxxxxx 8 | WMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWWWNNNNNNNNNXXXXXXKKKKKK00000OOOOOkkkkkxx 9 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWNNNNNNNNXXXXXXKKKKK00000OOOOOkkkkxxx 10 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWNNNNNNNNXXXXXXKKKKK00000OOOOkkkxxxx 11 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWNXK00KNNNNNNNXXXXXXKKKKK0000OOOOkkkkxxxx 12 | MMMMMMMMMMMMMMMMMMMMMMMMMMMWKOkxxdolc:;;;,,,,cdk0XXXXXKKKKKK0000OOOOkkkkxxxxdd 13 | dxO00KKXNNNNNNXK0O0KXNNXOdl:::;;;,,,'''''''.......;;:loxO0000OOOOkkkkxddxxdddo 14 | ;;:cccllllllccccllc;;,''.....''...................... ..... ... ... . 15 | '',,;;;;;;;;;,,''',,'.................... 16 | ....''''''''.................. 17 | .......................... 18 | .......'''''''............... .. 19 | ...'',cdxxxxxxoclo::::::::::; .... 20 | ..';lxXM0kxxl'','........ . 21 | .',;;oKWMN0xo;..... 22 | ...',:oddl:;,'.... 23 | .....''''.......... 24 | ........... 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/2xnormal-b.txt: -------------------------------------------------------------------------------- 1 | +------------------------------------------------------------------------------+ 2 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 3 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 4 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 5 | |MMMMMMWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 6 | |MMMMWk:';oXMMMMMMMMMMMMMMMMMMMMMMMMMMMWKxl;,''';cdKWMMMMMMMMMMMMMMMMMMMMMMMMMM| 7 | |MMMMK, .dMMMMMMMMMMMMMMMMMMMMMMMMMMWo. .cKMMMMMMMMMMMMMMMMMMMMMMMMM| 8 | |MMMMWx;',oXMMMMMMMMMMMMMMMMMMMMMMMMMMN' . ,KMMMMMMMMMMMMMMMMMMMMMMMM| 9 | |MMMWOllcllxNMMNklllllOKxlc:cldONMMMMMN;;dO0KOo. dMMMMMWKkdoc:::clokXWMMMM| 10 | |MMMWc '0MMK, .cOWMMWXWMMMMMMd .kMMMWx'. ... .:0MMM| 11 | |MMMWc '0MMK, .:oxd:. .xMMMMMMMMMMN: oWMMMNc.,ok0XXXx. :NMM| 12 | |MMMWc '0MMK, lWMMMWx. :XMMMMMMMMXc .dNMMMMW00WMWNKkdc. ;XMM| 13 | |MMMWc '0MMK, lWMMMMK, ,KMMMMMMWO, 'OWMMMMMMMXkl;.. .. ;XMM| 14 | |MMMWc '0MMK, lWMMMMk. :NMMMMM0c. .cKWWWWWMMWx. .oOK: ;XMM| 15 | |MMMWc '0MMK, .oxOkl. .kMMMMXo. .'''''';OMO. .xMMK; ,0NN| 16 | |MMMWc '0MMK, .kWMMM0, .xM0' .c:. .,k| 17 | |MMMNc '0MMK, 'c;,''',:okNMMMMXo;;;;;;;;;;;;;;;c0MW0o;,''',:odc,'',;:oK| 18 | |MMNx. ,KMMK, lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 19 | |MXc .dWMMK, lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 20 | |MMk. 'xNMMMK, lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 21 | |MMWk::okNMMMMMNd::::cOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 22 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 23 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 24 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 25 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 26 | +------------------------------------------------------------------------------+ 27 | +------------------------------------------------------------------------------+ 28 | |MMMMMMMMMMMMM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;;;;;;;;;;;c0MW0o;,''',:odc,'',;:oK| 44 | |MMNx. ,KMMK, lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 45 | |MXc .dWMMK, lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 46 | |MMk. 'xNMMMK, lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 47 | |MMWk::okNMMMMMNd::::cOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 48 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 49 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 50 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 51 | |MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 52 | +------------------------------------------------------------------------------+ 53 | -------------------------------------------------------------------------------- /tests/logo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jp2a converted image 6 | 17 | 18 | 19 |
20 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
21 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
22 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
23 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
24 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
25 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
26 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
27 | MMMMMMWNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNNNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
28 | MMMMMXdcl0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN0dcc:clkXMMMMMMMMMMMMMMMMMMMMMMMMMMMM
29 | MMMMNo.  ;KMMMMMMMMMMMMMMMMMMMMMMMMMMMMNXOc'      .:kWMMMMMMMMMMMMMMMMMMMMMMMMMM
30 | MMMMK,    dMMMMMMMMMMMMMMMMMMMMMMMMMMMKl;.          .xWMMMMMMMMMMMMMMMMMMMMMMMMM
31 | MMMM0'    dMMMMMMMMMMMMMMMMMMMMMMMMMMWo              .OMMMMMMMMMMMMMMMMMMMMMMMMM
32 | MMMMNl   ,0MMMMMMMMMMMMMMMMMMMMMMMMMMN:               cNMMMMMMMMMMMMMMMMMMMMMMMM
33 | MMMMMKo:lOWMMMMMMMMMMMMMMMMMMMMMMMMMMNc     ...       .OMMMMMMMMMMMMMMMMMMMMMMMM
34 | MMMMX0OkO0KWMMWK00000XMN0xxxOXWMMMMMMN:   ;okkx;      .dMMMMMMMWNKkxxxxOXWMMMMMM
35 | MMMWd'''''cKMMXl'''''dkc'....;dXMMMMMNc.;oKMMMM0,      dMMMMMW0o:,......;o0WMMMM
36 | MMMWc     '0MMK,     ..       .:0MMMMNkkXNMMMMMWo      dMMMMKl'           ,OWMMM
37 | MMMWc     '0MMK,                ;KMMMWNWMMMMMMMMx.    .xMMMWl              ,0MMM
38 | MMMWc     '0MMK,                 lNMMMMMMMMMMMMMd     .OMMMN:    .','.      dMMM
39 | MMMWc     '0MMK,      .;c;.      .OMMMMMMMMMMMMWl     cNMMMNc  ,ok0K0l.     cWMM
40 | MMMWc     '0MMK,     'xXNXd.      oMMMMMMMMMMMMK;    .xMMMMNc.lKWMMMMK,     :NMM
41 | MMMWc     '0MMK,     lWMMMWo      cNMMMMMMMMMMWd.    :XMMMMWkxNMMMMWXx'     ;XMM
42 | MMMWc     '0MMK,     lWMMMMO.     ;XMMMMMMMMMMK,    .OMMMMMMWWMMWXkl;.      ;XMM
43 | MMMWc     '0MMK,     lWMMMMK,     ,KMMMMMMMMMNc    .oWMMMMMMMMW0o;.         ;XMM
44 | MMMWc     '0MMK,     lWMMMMX;     ,KMMMMMMMMNo.    :XMMMMMMMMKl'    .,.     ;XMM
45 | MMMWc     '0MMK,     lWMMMM0'     ;XMMMMMMMWx.    ,0MMMMMMMM0;     ,d0;     ;XMM
46 | MMMWc     '0MMK,     lMMMMWd      cWMMMMMMWk.    .xNNNNNNWMNc     ;KWN:     ;XMM
47 | MMMWc     '0MMK,     ;0WMWO'      dMMMMMMM0'     .;:::::l0MO'    .xMMN:     :NMM
48 | MMMWc     '0MMK,      'ldl'      '0MMMMMMK;             .xMx.    .xMMK,     ,OKN
49 | MMMWc     '0MMK,                 lWMMMMXOc              .xMk.     ;xd;       ,:k
50 | MMMWc     '0MMK,                ;KMMMMXl.               .xMK,      ..          d
51 | MMMWc     '0MMK,               ;0MMMMXl.                .xMWd.       ..       .x
52 | MMMNc     '0MMK,     ,c.    .,oKMMMMMO;.'''''''''''''''',OMMXo'.   .,dk:.   .;dX
53 | MMMN:     '0MMK,     lNOddddxKWMMMMMMX0O00000000000000000NMMMW0xdddxKWMKxdddkKWM
54 | MMMK,     ,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MMM
67 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
68 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
69 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
70 | 
71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # Process this file with autoconf to produce a configure script. 3 | 4 | AC_PREREQ(2.60) 5 | AC_INIT([jp2a], [1.0.8], [csl@csl.name]) 6 | AM_INIT_AUTOMAKE(dist-bzip2) 7 | AC_CONFIG_SRCDIR(src/jp2a.c) 8 | AC_CONFIG_HEADER([config.h]) 9 | AC_CONFIG_FILES([Makefile src/Makefile]) 10 | 11 | # Checks for programs. 12 | AC_PROG_CC 13 | 14 | # Checks for libraries. 15 | AC_ARG_WITH([jpeg-include], 16 | AC_HELP_STRING([--with-jpeg-include=PATH], [specify path to directory containing jpeglib.h -- http://www.ijg.org/]), 17 | [CPPFLAGS="$CPPFLAGS -I$withval"]) 18 | 19 | AC_ARG_WITH([jpeg-lib], 20 | AC_HELP_STRING([--with-jpeg-lib=PATH], [specify path to directory containing jpeglib lib file -- http://www.ijg.org/]), 21 | [LDFLAGS="$LDFLAGS -L$withval"]) 22 | 23 | AC_ARG_WITH([jpeg-prefix], 24 | AC_HELP_STRING([--with-jpeg-prefix=PATH], [this is the same as --with-jpeg-include=PATH/include and --with-jpeg-lib=PATH/lib]), 25 | [CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib"]) 26 | 27 | AC_ARG_WITH([curl-config], 28 | AC_HELP_STRING([--with-curl-config=PATH], [specify path to curl-config]), 29 | [curl_config_path="$withval" enable_curl="yes"], 30 | [curl_config_path="$PATH"]) 31 | 32 | AC_CHECK_LIB([jpeg], [jpeg_start_decompress], [LIBS="$LIBS -ljpeg"]) 33 | 34 | if test "x$ac_cv_lib_jpeg_jpeg_start_decompress" != "xyes" ; then 35 | AC_MSG_ERROR([I need a working jpeglib; please specify --with-jpeg-lib=PATH or see --help for more explicit options. 36 | 37 | On many systems, this is installed in /usr/local/lib/ so you can try --with-jpeg-prefix=/usr/local/ 38 | ]) 39 | fi 40 | 41 | AC_ARG_ENABLE([curl], 42 | AC_HELP_STRING([--enable-curl], [enable to be to use libcurl (http://curl.haxx.se) to download images from the net (default: yes)]), 43 | [enable_curl=$enableval], 44 | [enable_curl="yes"]) 45 | 46 | AC_ARG_ENABLE([termlib], 47 | AC_HELP_STRING([--enable-termlib], [enable to use term/curses for detecting terminal dimensions (default: yes)]), 48 | [enable_termlib=$enableval], 49 | [enable_termlib="yes"]) 50 | 51 | AC_MSG_CHECKING([enable-curl]) 52 | AC_MSG_RESULT([$enable_curl]) 53 | 54 | if test "x$enable_curl" = "xyes" ; then 55 | AC_PATH_PROGS([curl_config], [curl-config], [no], [$curl_config_path]) 56 | 57 | if test "x$curl_config" != "xno" ; then 58 | curl_cflags="`$curl_config --cflags`" 59 | curl_libs="`$curl_config --libs`" 60 | CPPFLAGS="$CPPFLAGS $curl_cflags" 61 | 62 | AC_MSG_CHECKING([curl-config --cflags]) 63 | AC_MSG_RESULT([$curl_cflags]) 64 | 65 | AC_MSG_CHECKING([curl-config --libs]) 66 | AC_MSG_RESULT([$curl_libs]) 67 | fi 68 | 69 | if test "x$curl_libs" = "x" ; then 70 | curl_libs="-lcurl" 71 | fi 72 | 73 | AC_CHECK_LIB([curl], [curl_easy_init], [LIBS="$LIBS $curl_libs" AC_DEFINE([FEAT_CURL], [1], [Found working libcurl environment])], [ 74 | AC_MSG_WARN([I need a working libcurl (use --with-curl-config=PATH); download-support will be disabled]) 75 | enable_curl="no" 76 | ]) 77 | fi 78 | 79 | # Checks for header files. 80 | AC_HEADER_STDC 81 | 82 | AC_CHECK_HEADER([jpeglib.h], 83 | [ AC_DEFINE([HAVE_JPEGLIB_H], [1], [Define to 1 if you have header file.]) ], 84 | [ AC_MSG_ERROR([required header file jpeglib.h not found, use --with-jpeg-include=PATH or see --help]) ]) 85 | 86 | if test "x$enable_curl" = "xyes" ; then 87 | AC_CHECK_HEADER([curl/curl.h], 88 | [ AC_DEFINE([HAVE_CURL_CURL_H], [1], [Define to 1 if you have the header file]) ], 89 | [ AC_MSG_WARN([required header file curl/curl.h not found, libcurl will be disabled (see --help)]) ]) 90 | fi 91 | 92 | AC_CHECK_HEADERS([fcntl.h curses.h term.h ncurses/term.h]) 93 | 94 | if test "$enable_termlib" = "yes" ; then 95 | 96 | # Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but 97 | # rather ncurses. So we check for it. 98 | TERMLIBS= 99 | # Check for termlib before termcap because Solaris termcap needs libucb. 100 | TERMLIB_VARIANTS="ncurses curses termlib termcap terminfo" 101 | for termlib in ${TERMLIB_VARIANTS}; do 102 | AC_CHECK_LIB(${termlib}, tgetent, 103 | [TERMLIBS="${TERMLIBS} -l${termlib}"; break]) 104 | done 105 | # don't bother warning on djgpp, it doesn't have a term library, it 106 | # ports each termcap-needing program separately according to its needs. 107 | if test -z "$TERMLIBS" && echo "$build" | grep -v djgpp >/dev/null; then 108 | AC_MSG_WARN([probably need a terminal library, one of: ${TERMLIB_VARIANTS}]) 109 | else 110 | LIBS="$LIBS $TERMLIBS" 111 | AC_DEFINE([FEAT_TERMLIB], [1], [Found working term/curses environment]) 112 | fi 113 | 114 | fi 115 | 116 | 117 | # Checks for typedefs, structures, and compiler characteristics. 118 | AC_C_CONST 119 | AC_C_INLINE 120 | AC_C_RESTRICT 121 | AC_TYPE_SIZE_T 122 | 123 | # Checks for library functions. 124 | AC_CHECK_FUNCS([memset]) 125 | AC_CHECK_FUNCS([atexit]) 126 | AC_FUNC_FORK 127 | AC_TYPE_PID_T 128 | 129 | AC_HEADER_ASSERT 130 | 131 | AC_FUNC_MALLOC 132 | AC_OUTPUT 133 | -------------------------------------------------------------------------------- /tests/normal-verbose.txt: -------------------------------------------------------------------------------- 1 | File: jp2a.jpg 2 | Source width: 80 3 | Source height: 50 4 | Source color components: 1 5 | Output width: 78 6 | Output height: 24 7 | Output palette (23 chars): ' ...',;:clodxkO0KXNWM' 8 | Decompressing image [##....................................................]Decompressing image [###...................................................]Decompressing image [####..................................................]Decompressing image [#####.................................................]Decompressing image [######................................................]Decompressing image [########..............................................]Decompressing image [#########.............................................]Decompressing image [##########............................................]Decompressing image [###########...........................................]Decompressing image [############..........................................]Decompressing image [#############.........................................]Decompressing image [##############........................................]Decompressing image [###############.......................................]Decompressing image [################......................................]Decompressing image [#################.....................................]Decompressing image [##################....................................]Decompressing image [###################...................................]Decompressing image [#####################.................................]Decompressing image [######################................................]Decompressing image [#######################...............................]Decompressing image [########################..............................]Decompressing image [#########################.............................]Decompressing image [##########################............................]Decompressing image [###########################...........................]Decompressing image [############################..........................]Decompressing image [#############################.........................]Decompressing image [##############################........................]Decompressing image [###############################.......................]Decompressing image [################################......................]Decompressing image [#################################.....................]Decompressing image [###################################...................]Decompressing image [####################################..................]Decompressing image [#####################################.................]Decompressing image [######################################................]Decompressing image [#######################################...............]Decompressing image [########################################..............]Decompressing image [#########################################.............]Decompressing image [##########################################............]Decompressing image [###########################################...........]Decompressing image [############################################..........]Decompressing image [#############################################.........]Decompressing image [##############################################........]Decompressing image [################################################......]Decompressing image [#################################################.....]Decompressing image [##################################################....]Decompressing image [###################################################...]Decompressing image [####################################################..]Decompressing image [#####################################################.]Decompressing image [######################################################]Decompressing image [#######################################################] 9 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 10 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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MMMMMMMMM 27 | MMk. 'xNMMMK, lWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 28 | MMWk::okNMMMMMNd::::cOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 29 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 30 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 31 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 32 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 33 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | jp2a 2 | ==== 3 | 4 | jp2a is a simple JPEG to ASCII converter. 5 | 6 | The source is available at . This project 7 | used to be hosted on SourceForge. 8 | 9 | License 10 | ------- 11 | 12 | Copyright 2006-2016 Christian Stigen Larsen 13 | Distributed under the GNU General Public License v2. 14 | 15 | You can read the full license in the file COPYING. jp2a also uses other 16 | libraries. These licenses can be found in the file LICENSES. 17 | 18 | Example: Oswald the lucky rabbit 19 | -------------------------------- 20 | ...... 21 | .:lOKMMMMMMMMMM0l 22 | .;dOMMMMMMMMMMMMMMMMMMW. 23 | .ckWMMMMMMMMMMMMMMMMMMMMMMMO 24 | .dXMMMMMMMMMMMMMMMMMMMMMMMMMMO 25 | .xWMMMMMMMMMMMMMMMMMMMMMMMMMMO:. 26 | lXMMMMMMMMMMMMMMMMMMMMMWOOxc' 27 | .;lxOOOOOxdl:. cMMMMMMMMMMMMMMMMWKklc'.. 28 | 'llc.. ..:oMMMMMMKxNMMMMMMMMMM0kl:'. 29 | :0' cMMMMMMMMMMMMWd'. 30 | .K:l0 .MMMMMMMMMMl. 31 | ,K W ,MMMMMMMMMMMMN0dl' 32 | M. M MMMMMMMMMMMMMMMMMMKx:. 33 | cMMK WMMMMMMMMMMMMMMMMMMMMMXd' 34 | NMMM: MMMMMMMMMMMXWMMMMMMMMMMMMNd' 35 | KMMMW MMMMMMMMMMM' ;XMMMMMMMMMMMMMWd' 36 | MMMM XMMMMMMMMMMM dMMMMMMMMMMMMMMMNc 37 | '' NMKWl' .KMMMMMMMMMMM' :MMMMMMMMMMMMMMMMMd 38 | KMWMKOk ' ,lXMMMMMMMMMMM; .KMMMMMMMMMMMMMMMM0 39 | KMMMMM. .cOMMMMMW' kMMMMMMMMMMMMMMMMX 40 | cOXMNXl. ...... .MWd. .0cc:' .NMMMMMMMMMMMMMMMk 41 | .cololoxKWWWXWMMMMMMM: M c:. .l0ok oMMMMMMMMMMMMMMM 42 | .'Mo,MMMMNk:lO' :l .OMMMMl .OMMMMMMMMMMMMN 43 | X0'OkxkxOK;. :: ,.XMMMMMMO :O lXMMMMMMMMk 44 | kc,,o0M0.:;c'N ko;lMMMMMM:'xMMMNWKO,.clxdl:. 45 | ;00xkM:d , .. oMMMMMM cMMMMMMMMl 46 | c N0l . .l:;;oKMMk MMMMMMMMM0 47 | O ,.ocOc..l..k' .:c;'O 0MMMMMMMX. 48 | X N..l .c K. OMMMMMMM 49 | .' c. : M . OMMM0,.; 50 | :, N.;W ; O...o .,. 51 | d M ;X' :l : 52 | d..':. lcKol,,,,'.:c,,'.cd;'o,'. 53 | . ;:,WMMMMMMXx,; M0XXNNWM. 54 | MMMMMMMM .MMMMMMMM 55 | MMMMMMMM .MMMMMMMM. 56 | :ONMMMMMM0:':MMMMMMMMM: 57 | ;c:,'',::lX' '','' .MMMMMMMMMMWK:c: 58 | x. .lloc;.',lxl..lKMMMMMKl M 59 | 0 .;,;'......;::c' .. ;dl;l' 60 | ;O: .d' .lkk::::;, 'k 61 | N.'oc'. M : X 62 | lo:. ',::xN: .x0' 63 | .,lccccM .ll,. . ;;:::;c'.0 64 | .kl. .c::lcccccc:cc::; .''clccl. 65 | 'lcl:lc::,,'::cc:cc:c,.. 66 | 67 | The Oswald character is Copyright Walt Disney, and, unfortunately, not in the 68 | public domain. However, I believe that I can use this picture under the fair 69 | use clause, for demonstrational purposes, especially in low-resolution, ASCII 70 | format. If I am wrong, I will promptly remove it. 71 | 72 | Installation 73 | ------------ 74 | 75 | Look in your system's package manager. I don't maintain Windows binaries 76 | anymore. 77 | 78 | Building 79 | -------- 80 | 81 | If you want to compile from source, you need autotools and automake. You may 82 | need to specify the path to jpeglib. I usually just do 83 | 84 | autoreconf -vi 85 | ./configure --with-jpeg-prefix=/usr/local \ 86 | --with-curl-config=`which curl-config` 87 | make -j 88 | 89 | Before installing, you may want to check that jp2a works by running `src/jp2a` 90 | on some `.jpg` files. The `check` target is currently broken, and won't help 91 | you. When you're ready to install, 92 | 93 | make -j install 94 | 95 | jp2a depends on jpeglib. In case configure fails beacuse jpeglib is not installed, 96 | it can be built and installed manually. Independent JPEG Group provides a UNIX format 97 | package in tar.gz format which can be downloaded from http://www.ijg.org/. 98 | 99 | Extract the archive and follow the instructions inside 'install.txt' to build and 100 | install it. For a default install, the corresponding `.so` (shared object) files 101 | will be present in `/usr/local/lib/` 102 | 103 | Next, run the command `ldconfig` (escalated privileges may be required) to configure dynamic linker run-time bindings. See 104 | its man page for more details. The configure command should work after that. 105 | 106 | If configure can't automatically find jpeglib, specify with 107 | 108 | ./configure --with-jpeg-include=PATH --with-jpeg-lib=PATH 109 | 110 | or you can just type the prefix 111 | 112 | ./configure --with-jpeg-prefix=/usr/local/ 113 | 114 | You can also compile jp2a with libcurl, so it can automatically download images 115 | from the net: 116 | 117 | ./configure --enable-curl 118 | 119 | This will look for `curl-config` in $PATH, but you can specify it directly with 120 | `--with-curl-config=PATH` if you need to. 121 | 122 | Windows 123 | ------- 124 | 125 | You need a working jpeglib for Windows and set up include paths yourself. 126 | You will need to manually type out a `config.h` file. Example: 127 | 128 | WIN32 129 | NDEBUG 130 | _CONSOLE 131 | PACKAGE_STRING=\"jp2a x.x.x-win32\" 132 | PACKAGE_BUGREPORT=\"csl@csl.name\" 133 | HAVE_STRING_H 134 | HAVE_STDLIB_H 135 | FEAT_CURL 136 | HAVE_CURL_CURL_H 137 | CURL_STATICLIB 138 | FEAT_TERMLIB 139 | 140 | You need to add jpeg.lib to the linker. If you want libcurl support, you need 141 | that as well. It should be available from http://curl.haxx.se 142 | -------------------------------------------------------------------------------- /tests/dalsnuten-256.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jp2a converted image 6 | 17 | 18 | 19 |
20 | KKKKKKKKKKKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXKKKKKKKKKKKKKKK00000000000OOOOOOOOkkkkkkkkxxxxxxddddddooooooooolll
21 | KXXXXXXXXXXXXXXXXXXXXXXXNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXKKKKKKKKKKKK00000000OOOOOOOOOkkkkkkkkxxxxxxdddddddoooooooo
22 | XXXXXXXXXXXXXXXXXXXXNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXKKKKKKKKKKK000000000OOOOOOOOOkkkkkkkxxxxxxddddddooooooo
23 | XXXXXXXXXXNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXKKKKKKKKKKK000000000OOOOOOOOkkkkkkkxxxxxxdddddddooooo
24 | XXXXNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXKKKKKKKKKKK00000000OOOOOOOOOkkkkkxxxxxxxxddddddoooo
25 | NNNNNNNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWNNNNNNNNNNNNNNNNNNNNNNNNN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XXXXXKKKKKKKK00000000OOOOOOOOkkkkkkkkxxxx
34 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWWWWWWWNNNNNNNNNNNNNXXXXXXXXXXXKKKKKKKK00000000OOOOOOOkkkkkkxxxxxx
35 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWWWWWWWNNNNNNNNNNNNNXXXXXXXXXXKKKKKKKKK00000000OOOOOOkkkkkkxxxxxx
36 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWWWWWWNNNNNNNNNNNNNNNXXXXXXXXKKKKKKKKKK000000OOOOOOOkkkkkkkxxxxx
37 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWNXK0OOO00XNNNNNNNNNNXXXXXXXXXXKKKKKKKK0000000OOOOOOkkkkkkkxxxxxxd
38 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXXK00OOkxoool:::;;;;;;;:okXNNNNXXXXXXXXXKKKKKKKKK0000000OOOOOOOkkkkkkxxxxxxddd
39 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWX0xdlc:::::;;;;;;,,,,,,,,,'''''',:ldkOKXXXXXKKKKKKKKK0000000OOOOOOOkkkkkkxxxxxxxdddd
40 | dxxO0KXXXNNWWWMMMMMMMMMWNXKK00XNWMMMMMMNKkoc::::::;;;;;,,,,,,,''''''''''..........';;:codk0KKK00000000OOOOOOkkkkkkkxxxxxxddddddo
41 | ::ccclllooodddxxxxxxxxddxxddollcclooooc;;,,,,,,,,,,,,,'''...................................;clddlccc;;:;:;:lddd::,',';,lolcc;::
42 | ,;;;:::ccccclllcllccc:::::clcc;;;;;,''........................................                                                  
43 | '',,,;;;::::::::::::;;;,,,,,,;;,''''''...................................                                                       
44 | ..''',,,;;;;;;;,,,,,,,''''.....'''.........................                                                                     
45 | ......''''''''''''''''..........................                                                                                
46 | ............''................................                                                                                  
47 | ...........................................                                                                                     
48 | ...................................  ........                                                                                   
49 |  ...'''...',,,,,,,,,,,,,,,,,,,''''',,;;;;;;;;;,.         .........                                                              
50 | ....','.',:ldxdddxxxxxxddooddollllooolllllllcc:.           ......                                                               
51 | ......',;cox0XX0kkkxxdl:,',cc,....,''''......''.                                                                                
52 |  .....,:lodOWMWOxxxdxxl,'.',............                                                                                        
53 | .....';;cxKWMMMWXXKOOx;'''......                                                                                                
54 | .'';,;;;cd0XWMWX0xoc;''.......                                                                                                  
55 | ......,;:cdxkkxocc:;,''.....                                                                                                    
56 | .......',;;:::;,,''............                                                                                                 
57 |  ........'''''.................                                                                                                 
58 |  ..  .................. .                                                                                                       
59 |        ..............                                                                                                           
60 |              . .                                                                                                                
61 |                                                                                                                                 
62 |                                                                                                                                 
63 |                                                                                                                                 
64 |                                                                                                                                 
65 |                                                                                                                                 
66 |                                                                                                                                 
67 |                                                                                                                                 
68 | 
69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /tests/dalsnuten-256-light.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jp2a converted image 6 | 17 | 18 | 19 |
20 | ........................................................................................'''''''',,,,,,,,;;;;;;::::::ccccccccclll
21 | ........................                      ............................................''''''''',,,,,,,,;;;;;;:::::::cccccccc
22 | ....................                               ..........................................''''''''',,,,,,,;;;;;;::::::ccccccc
23 | ..........                                              .......................................'''''''',,,,,,,;;;;;;:::::::ccccc
24 | ....                                                          ..................................''''''''',,,,,;;;;;;;;::::::cccc
25 |                                                                    ...............................'''''''',,,,,,,;;;;;;::::::::c
26 |                                                                        ..............................''''''',,,,,,;;;;;;::::::::
27 |                                                                          .............................''''''',,,,,,,;;;;;;::::::
28 |                                                                            ............................'''''''',,,,,,,;;;;;:::::
29 |                                                                              ............................''''''',,,,,,;;;;;;;:::
30 |                                                                              ..............................''''''',,,,,,;;;;;;;:
31 |                                                                                 ............................''''''',,,,,,,,;;;;;
32 |                                                                                 ............................'''''''',,,,,,,,;;;;
33 |                                                                                   ..........................'''''''',,,,,,,,;;;;
34 |                                                                                   ...........................''''''',,,,,,;;;;;;
35 |                                                                                    ...........................'''''',,,,,,;;;;;;
36 |                                                                                      ........................''''''',,,,,,,;;;;;
37 |                                                                 ...'''...          .........................'''''',,,,,,,;;;;;;:
38 |                                                   .....'',;cccldddxxxxxxxdc,.    .........................''''''',,,,,,;;;;;;:::
39 |                                             ..;:lodddddxxxxxxkkkkkkkkkOOOOOOkdl:,'......................''''''',,,,,,;;;;;;;::::
40 | :;;'.....                ......         .,coddddddxxxxxkkkkkkkOOOOOOOOOO0000000000Oxxdoc:,............'''''',,,,,,,;;;;;;::::::c
41 | ddooolllccc:::;;;;;;;;::;;::clloolccccoxxkkkkkkkkkkkkkOOO0000KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK0xol::loooxxdxdxdl:::ddkOkOxklclooxdd
42 | kxxxdddooooolllollooodddddolooxxxxxkOO000000000000000KKKKKKXXXXXXXXXXXXXXXXXXXNNNNNNNNNNNNNNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWW
43 | OOkkkxxxddddddddddddxxxkkkkkkxxkOOOOOO000KKKKXKKKKKXXXXXXXXXXXXXXXXXXXXXXNNNNNNNNNNNNNNNWNNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWMMMMMM
44 | 00OOOkkkxxxxxxxkkkkkkkOOOO00000OOO00KKKKKKKKKXXXXXXXXXXXXXXNNNNNNNNNNNNNNNNNNNNNNNNNNWWWWNNNNNWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMM
45 | K00000OOOOOOOOOOOOOOOO0000KKKKKKK0000KKKXXXXXXXXNNNNNNNNNNNNNNNNNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMM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M
62 | WWWWWWWWWWWNNNWWNWWWWWWNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
63 | MWWWWWWWWWWWWWWWNWNNNNWWWWWWWWWWWWWWWWWWWMWWMMMMMMMMMMMMMMMMMMMMMMMWMWWMWWWWWMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW
64 | MWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMMMMWWMMMMMMMMMMMMMMMMMMMMMMWWWWMMWMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
65 | WWWWWWWWWWWWWWWWWWWWWMMMMWWWWMMMMMWMMMMMMMMMMMMMMMMMMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWMM
66 | WWWWWWWMWWWWWWMWMWWWMMMMWMWMMMMMMMMMMMMMMMMMMMMWMMWMMWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
67 | MWWWMWMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
68 | 
69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /tests/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2006-2016 Christian Stigen Larsen 4 | # 5 | # This is a small script to test if jp2a has been correctly built. 6 | 7 | ## PATH TO EXECUTABLE jp2a 8 | JP=../src/jp2a 9 | UNAME=`uname -a` 10 | UPDATE=no 11 | 12 | if test "`echo ${UNAME} | cut -c1-6`" == "CYGWIN" ; then 13 | JP=../src/jp2a.exe 14 | fi 15 | 16 | if test "${1}" == "update" ; then 17 | UPDATE=yes 18 | fi 19 | 20 | ## INITIALIZE VARS 21 | RESULT_OK=0 22 | RESULT_FAILED=0 23 | FAILED_STR="" 24 | 25 | function print_intense() { 26 | echo -e -n "\033[1m${1}\033[0m" 27 | } 28 | 29 | function test_ok() { 30 | print_intense "OK" 31 | RESULT_OK=$((RESULT_OK + 1)) 32 | } 33 | 34 | function test_failed() { 35 | print_intense "FAILED" 36 | RESULT_FAILED=$((RESULT_FAILED + 1)) 37 | FAILED_STR="${FAILED_STR}\n${2} | diff --strip-trailing-cr --brief - ${1}" 38 | } 39 | 40 | function test_jp2a() { 41 | CMD="${JP} ${2}" 42 | printf "test (%2s) %-32s " "$((RESULT_OK+RESULT_FAILED+1))" "(${1})" 43 | 44 | if [ ! -e "${3}" ] ; then 45 | print_intense "(missing ${3}) " 46 | test_failed ${3} "${CMD}" 47 | else 48 | if test "${UPDATE}" == "no" ; then 49 | eval ${CMD} | diff --strip-trailing-cr --brief - ${3} 1>/dev/null && test_ok || test_failed ${3} "${CMD}" 50 | else 51 | eval ${CMD} > ${3} 52 | test_ok 53 | fi 54 | fi 55 | 56 | echo "" 57 | } 58 | 59 | function test_results() { 60 | echo "" 61 | echo "TEST RESULTS FOR JP2A" 62 | echo "" 63 | printf "Tests OK : %2d of %2d (%4s)\n" "$((RESULT_OK))" "$((RESULT_OK+RESULT_FAILED))" "$((100*RESULT_OK/(RESULT_OK+RESULT_FAILED)))%" 64 | printf "Tests FAILED: %2d of %2d (%4s)\n" "$((RESULT_FAILED))" "$((RESULT_OK+RESULT_FAILED))" "$((100*RESULT_FAILED/(RESULT_OK+RESULT_FAILED)))%" 65 | echo "" 66 | 67 | if test "x${FAILED_STR}" != "x" ; then 68 | echo "Summary of failed tests:" 69 | echo -e "${FAILED_STR}" 70 | fi 71 | } 72 | 73 | echo "-------------------------------------------------------------" 74 | echo " TESTING JP2A BUILD" 75 | echo " " 76 | echo " Note that the output may vary a bit on different platforms," 77 | echo " so some tests may fail. This does not mean that jp2a is" 78 | echo " completely broken." 79 | echo "-------------------------------------------------------------" 80 | echo "" 81 | 82 | test_jp2a "width" "--width=78 jp2a.jpg" normal.txt 83 | test_jp2a "border, width" "-b --width=78 jp2a.jpg" normal-b.txt 84 | test_jp2a "size" "--size=160x49 jp2a.jpg" 160x49.txt 85 | test_jp2a "height" "--height=10 jp2a.jpg" 10h.txt 86 | test_jp2a "size" "--size=40x40 jp2a.jpg" 40x40.txt 87 | test_jp2a "size" "--size=1x1 --invert jp2a.jpg" 1x1-inv.txt 88 | test_jp2a "invert, border" "-i -b --width=110 --height=30 jp2a.jpg" 110x30-i-b.txt 89 | test_jp2a "width, flip, invert" "--width=78 --flipx --flipy --invert jp2a.jpg" flip-xy-invert.txt 90 | test_jp2a "width, border" "--width=78 -b jp2a.jpg jp2a.jpg" 2xnormal-b.txt 91 | test_jp2a "width, verbose" "--verbose --width=78 jp2a.jpg 2>&1 | tr -d '\r'" normal-verbose.txt 92 | 93 | TEMPFILE=`mktemp /tmp/jp2a-test-XXXXXX` 94 | test_jp2a "width, outfile" "--width=78 jp2a.jpg --output=${TEMPFILE} && cat ${TEMPFILE}" normal.txt 95 | rm -f ${TEMPFILE} 96 | 97 | test_jp2a "width, clear" "--width=78 jp2a.jpg --clear" normal-clear.txt 98 | test_jp2a "height, grayscale" "logo-40x25-gray.jpg --height=30" logo-30.txt 99 | test_jp2a "size, invert" "grind.jpg -i --size=80x30" grind.txt 100 | test_jp2a "size, invert, red channel" "grind.jpg -i --size=80x30 --red=1.0 --green=0.0 --blue=0.0" grind-red.txt 101 | test_jp2a "size, invert, blue channel" "grind.jpg -i --size=80x30 --red=0.0 --green=1.0 --blue=0.0" grind-green.txt 102 | test_jp2a "size, invert, green channel" "grind.jpg -i --size=80x30 --red=0.0 --green=0.0 --blue=1.0" grind-blue.txt 103 | test_jp2a "width, grayscale" "--width=78 dalsnuten-640x480-gray-low.jpg" dalsnuten-normal.txt 104 | test_jp2a "invert, width, grayscale" "--invert --width=78 dalsnuten-640x480-gray-low.jpg" dalsnuten-invert.txt 105 | test_jp2a "invert, size, grayscale" "--invert --size=80x49 dalsnuten-640x480-gray-low.jpg" dalsnuten-80x49-inv.txt 106 | test_jp2a "size, invert, border" "dalsnuten-640x480-gray-low.jpg --size=80x25 --invert --border --size=150x45" dalsnuten-640x480-gray-low.txt 107 | test_jp2a "size, html" "--size=80x50 --html --html-fontsize=7 jp2a.jpg" logo.html 108 | test_jp2a "size, color, html, flipx" "--size=80x50 --html --color --html-fontsize=8 --flipx grind.jpg" grind-flipx.html 109 | test_jp2a "size, color, html, flipy" "--size=80x50 --html --color --html-fontsize=8 --flipy grind.jpg" grind-flipy.html 110 | test_jp2a "size, color, html, flipxy" "--size=80x50 --html --color --html-fontsize=8 --flipx --flipy grind.jpg" grind-flipxy.html 111 | test_jp2a "width, html, gray, dark" "dalsnuten-640x480-gray-low.jpg --width=128 --html --html-fontsize=8" dalsnuten-256.html 112 | test_jp2a "width, html, gray, light" "dalsnuten-640x480-gray-low.jpg --width=128 --background=light --html --html-fontsize=8" dalsnuten-256-light.html 113 | test_jp2a "color, html, dark" "grind.jpg --color --background=dark --width=60 --html --html-fontsize=8" grind-color-dark.html 114 | test_jp2a "color, html, dark fill" "grind.jpg --color --fill --background=dark --width=60 --html --html-fontsize=8" grind-color-dark-fill.html 115 | test_jp2a "color, html, light" "grind.jpg --color --fill --background=light --width=60 --html --html-fontsize=8" grind-color.html 116 | test_jp2a "color, html, grayscale" "dalsnuten-640x480-gray-low.jpg --color --width=78 --html --background=light --fill --html-fontsize=8" dalsnuten-color.html 117 | test_jp2a "color, html, --grayscale" "grind.jpg --color --width=78 --html --grayscale" grind-2grayscale.html 118 | test_jp2a "color, html, --grayscale, fill" "grind.jpg --color --width=78 --html --grayscale --fill" grind-2grayscale-fill.html 119 | test_jp2a "color, fill" "grind.jpg --colors --fill --width=78" grind-fill.txt 120 | test_jp2a "color, fill, --grayscale" "grind.jpg --colors --fill --grayscale --width=78" grind-2grayscale-fill.txt 121 | test_jp2a "color, html, no-bold" "grind.jpg --colors --html --html-no-bold --width=78" grind-nobold.html 122 | test_jp2a "html-title, html" "--width=10 --html --html-title='just testing' jp2a.jpg" html-title.txt 123 | test_jp2a "color, html-raw" "--width=10 --color --html-raw jp2a.jpg" html-raw.txt 124 | test_jp2a "color" "grind.jpg --color --width=60" grind-color.txt 125 | test_jp2a "color, grayscale" "dalsnuten-640x480-gray-low.jpg --color --width=78" dalsnuten-color.txt 126 | test_jp2a "standard input, width" " 2>/dev/null ; cat jp2a.jpg | ${JP} --width=78 -" normal.txt 127 | test_jp2a "standard input, width, height" " 2>/dev/null ; cat jp2a.jpg | ${JP} - --width=40 --height=40" 40x40.txt 128 | test_jp2a "big size" "--size=2000x2000 dalsnuten-640x480-gray-low.jpg jp2a.jpg | tr -d '\r' | wc -c | tr -d ' '" dalsnuten-jp2a-2000x2000-md5.txt 129 | test_jp2a "size, curl download" "--size=454x207 http://jp2a.sourceforge.net/jp2a.jpg" normal-curl.txt 130 | test_jp2a "size, curl download" "--size=454x207 http://jp2a.sf.net/jp2a.jpg" normal-curl.txt 131 | 132 | test_results 133 | -------------------------------------------------------------------------------- /tests/grind-color.txt: -------------------------------------------------------------------------------- 1 | ''..;';ldd00MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW 2 | ,...''',;ccoKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNW 3 | .......'';:xNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNMM 4 | ...',..,,:oKWMMMMWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMWMMM 5 | .....c,:,:lcoxk0XXXXXXXNNNNNNNNNNNNNNNWWWWMMMMMMMMMMMMMMMMMM 6 | .....,..:::;ldkO0KKKKXXXXKKK0000KKKKKKXXNNNNWWWWWNNNNNNNNNNN 7 | .......',;:ox0000OO0O0OxdxkkddxkOOOOkO0OO0KXXXXKkkkO00OOOkkx 8 | ..,..,;ckkkkkkkkkxdddxdcclollclxkkxddxkxkO00KK00OkkO00OOOkkk 9 | ..'..:::xkxxdxxoc:cddddoodddddxxxxodkkkkOOOOOOOkkkkkkkkkkkxx 10 | ......,';,;:ldddooddodxxxxxxxxkxxkoxxxxxxkkkxxxdxxddddddoooo 11 | ..';;;::cc::clco0XXKKkollodxxkxkkxokkkkkxdxxxddxxxddooddolll 12 | ...,cccc;l:;c::l0NKxNKd0occodddxxookkkxxxxxdddddddoolollllll 13 | ......::':;,c;lOocOcW0;xko,;ccldlcodddoodddooooolcclclccc::: 14 | .....''.,'.'.'cc,c;::,,c:;;;,:l:,,cooddoxddddlcllc:cclllcc; 15 |  .....''.,'...:l;.l.'..'lo'l,.'.'''.';c;',ccc:c,.,,,;,;'..'. 16 |  .. .... ...;,:o:'l,olc,',';;...'.' ......,,,,..,....,'.  .  17 |  ..  ...'..:,:d:'d,kOd,dl.,c.;;;,' ............,,.. ..  . . 18 | . ...clcxlokl;o:ddl'clc:;.,;:'..c;....... ............. 19 | ..,codxxxxkkkkkkxxoooxdl;,;'. ..........;::;;,,; 20 | ......';looodxddddddc;,,..,lllc::,,'',''... .... .'..';:: 21 | ...,coodddxxxxxddd;'...';odddooooooollc:,....''..'''...;:: 22 | .....,ldxkkxkkkxxddo:;' :dxxxxxxddddddoool:;::;,,,;;::::cc:: 23 | ....'codxkkkkkxxddoollc;oxxkkxkkxxddddddoodollc,''';;cc:cc:: 24 | -------------------------------------------------------------------------------- /tests/dalsnuten-640x480-gray-low.txt: -------------------------------------------------------------------------------- 1 | +------------------------------------------------------------------------------------------------------------------------------------------------------+ 2 | |.......................................................................................................''''''''',,,,,,,,,;;;;;;;;:::::::ccccccccccllll| 3 | |............................ ....................................................'''''''''',,,,,,,,,;;;;;;;;::::::::ccccccccc| 4 | |...................... .................................................'''''''''',,,,,,,,,;;;;;;;:::::::cccccccc| 5 | |......... ..........................................'''''''''',,,,,,,,;;;;;;;::::::::cccccc| 6 | |.... ........................................''''''''''',,,,,,,,;;;;;;::::::::cccc| 7 | | .....................................'''''''',,,,,,,,;;;;;;;;:::::::::c| 8 | | ...................................''''''',,,,,,,,;;;;;;;;::::::::| 9 | | ..................................''''''''',,,,,,,;;;;;;;:::::::| 10 | | .................................''''''''',,,,,,,,;;;;;;;::::| 11 | | ..................................''''''''',,,,,,,;;;;;;;;::| 12 | | ..................................''''''''',,,,,,,,;;;;;;;| 13 | | ................................'''''''''',,,,,,,,,;;;;;| 14 | | ................................''''''''',,,,,,,,,;;;;;| 15 | | ...............................''''''''',,,,,,,;;;;;;;| 16 | | ...............................''''''',,,,,,,;;;;;;;| 17 | | ............................''''''''',,,,,,,,;;;;;;| 18 | | ....',,''... .............................'''''''',,,,,,,;;;;;;;;:| 19 | | .....',,;;:cllooodxxxxxxxxxxxdl;'.. ...............................'''''''',,,,,,,,;;;;;;;:::| 20 | | ..';cloddddddxxxxxxxkkkkkkkkOOOOOOOOOOOOOxdoc:,'........................''''''',,,,,,,,;;;;;;;;:::::| 21 | |oolc:;,,''........... ...',,;;,,'.. .';coddddddxxxxxxxkkkkkkOOOOOOOOOO000000000000000000000OOxxol:;'.........'''''''',,,,,,,;:;;::;;;:::::::c| 22 | |xddddoooolllccccccccclllloollc:ccllooddxxkkkkkOOOOOOOOOOOOOOOOO000KKKKKKKXXXXXXXXXXXKKKKXXXXXXXXXXXXXXXXXXXXX0OkxxOO00KXX0XKKK0xxxd00XXNNWXKKxxkOO0X00| 23 | |OkkxxxddddddoooooodooodddddxxxxxdddxkkkkkkkOO00KKKKKKKKKKK0KKKKKKKKKKXXXXXXXXXXXXXXXXXXXNNNNNNNNNNNNNNNNNNNNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWMWW| 24 | |0OOOkkkkxxxxxxxxxxxxxxxxkkkkkOOOOOOkkkOO00000000KKKKXXXXXXXXXXX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MMMMMMMMMMMMMMMMMMMMMMMWMM| 45 | |WWWWWWWWWWWWWWWWMMWWWWWWMMMMMWWWMMMMMMMMMMMMMMMMMMMMMMMMMMWWMMWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 46 | |MWWWWMWMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM| 47 | +------------------------------------------------------------------------------------------------------------------------------------------------------+ 48 | -------------------------------------------------------------------------------- /tests/dalsnuten-640x480-rgb-low.txt: -------------------------------------------------------------------------------- 1 | +------------------------------------------------------------------------------------------------------------------------------------------------------+ 2 | |XXXXXXXXXXNNXXNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXKKKKKKKKKKKKK000000000OOOOOOOOOOOOkkkkkkkkkkkxxxxx| 3 | |NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXKKKKKKKKKKKKK00000000000OOOOOOOOOkkkkkkkkkkkkx| 4 | |NNNNNNNNNNNNNNNNNNNNNNNNNWWNNNNNNNNNNNNNNNNNNNNNNWWWWNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXKXKKKKKKKKKKKK00000000000OOOOOOOOOkkkkkkkkkkk| 5 | |NNNNNNNNNNNNNNNNNNNNNWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWNNNNNNNNNNNNNNNNNNNNNNNNNNNNNXNNXXXXXXXXXXXXXXXKKK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llldxOKNNNNNNNNNXXXXXXXXXXXXXXXXXKKKKKKKKKKKKK000000000OOOOOOOOOOk| 20 | |WWMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNXK0kxdoooooolllllllccccccccccc::::::::::cooxkk0KKXKXXXXXXXXXXXKKKKKKKKKKKKK00000000000OOOOOOOOOOkkk| 21 | |oodokkO0000KKXXXNNNNNNNNWWNNXK00OOkOO0KXNWWWWXK0kdooooolllllllcccccccc::::::::::;;;;;;;;;;;;;;;;;;;;:;clldxk0KKKKKKKKKK00KK000000000O0kkOxkOOOkOOkkkkk| 22 | |cllloooodddddxxxxxxxxxdddddodxxkxdddoolllccc:::::::::::::::::::;;,,,,'''''''''''''''''''''''''''''''''''''.'',;:cl:,;';..,'''.,,ccl:';.....'.:cc;;;.';| 23 | |;:ccccclllllooooooooooolllllccccllllc::::::::;,,,,,,,,,,,,,,,,''''''''''''''.................................................. . | 24 | |;;;::::cccclcccccccccccccc:::::;;;;:::::;;,,,,,,,,'''''''''''''.......................................................... | 25 | |,,,;;;;;:::::::::::::::::;;;;;;,,,,,,,;;;,,,,,'''''''''................................................................ | 26 | |'',,,,,,,;;;;;;;;;;;;;;;;,,,,,,,,''''''''',,'''........................................... ... ................ | 27 | |'''''',,,,,,,,,,,,,,,,,,,,,,'''''''........'''''....................................... .. . | 28 | |..'''''',,,,,,,,,,,,,,,,,,,'''''''.......................... ................. . .... ..... .. . . | 29 | |....';;;;,',,::::;;:::::::;:;;;;;;;;,,,,,;;;:::::::::::;, .,,''......... . . ... . | 30 | |...',,:c;;;;loxkkkxxkkOOOOOkkxxkxkkxddddxxxxxdddxxxxdool. .. ....;,,,.'.............. .. . . | 31 | |..'',,,,;:lodxkXXXKOOOOOkkkll::codo,,,,,:c::;;;,;;;,,;;:,....................... . . . | 32 | |.....',;:lodxOKMMMKOkOOkOOkc,:;::;,'..'.',,''.............................. . ....... | 33 | |..',:;::ccox0NWMMMWXXXX0OOd;;:';'''.............. .... ............ . . .. . | 34 | |.,,;:::c:codO0XWWNXOkxol::;,,'''................. .. .......... ... . | 35 | |...''',,;:clodxxxdolccc:;:;,,''................... . . . . . . | 36 | |.....'',,,;:::c:::;;,;,,''','''''............ .. ... . . . | 37 | |.......'',,,,,;,,,,'''''''................. . . . .. | 38 | |...........''''''.................................... | 39 | |............................................. . . . | 40 | | .......................... ... .... . . .. . | 41 | | ......................... .... . . .... .. | 42 | | . . ................ . | 43 | | . .. | 44 | | | 45 | | | 46 | | | 47 | +------------------------------------------------------------------------------------------------------------------------------------------------------+ 48 | -------------------------------------------------------------------------------- /tests/grind-2grayscale-fill.txt: -------------------------------------------------------------------------------- 1 | '''..,,,;lxoxXOXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMW 2 | '....',',;;:cookWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWM 3 | ,'.......,;;;;lOXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNWW 4 | .......'..'',:o0NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNWMM 5 | .....;,..,,,:lxXMMMMMMWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 6 | ......,;'c',:lclxkO0XXXXXXXXXNNNNNNNNNNNNNNNNNNNWWWWWWMMMMMMMMMMMMMMMMMMMMMMMM 7 | '. ...':.',lcc;;lldkO0KKKXXXXXXXXXXXKKKKKKKKKXXXXXXNNNWWWWWMMMMWWWWWWWWWWWMMMM 8 | ..........,',,,cxO0000000KKKKKK0O000OOkOO00O000O0KKKKKXXXNNNNXK0000KXKK0000OOO 9 | ''......''c:clxkO0000OOkOOkOOxllldxdollodkOOOkkdxkkxxk00KKKKK0xdxxkO0OOOkkxxxd 10 | ...,..;.::kkOOkkkkkkkkxdddoxxo::cllolccldxkkkoxxdxkxkO000KKKKK0OkOO0000O0Okkkk 11 | ..','.,;:;dkkkxxxxxxoc:cldoddollooodddddxddxklxxkkkkOOOOOOOOkkkkkkkkkkkkkkkkxx 12 | .......,;';ccllcoxxdoloodxdxxxxxxxxxkkkkkkkkdoxkxxxxkkkkkkkkkxxxxxxddddddddddd 13 | ...''...''',,,:cloooxxxxxdooldddxxkxkxxxxxxxldxxkxxxxxkkkxxxdxxxxxdddoddooooll 14 | ....:cccclccc::ccccclOXXXXXKkoolllodxxkdkkkkokkkOOkkxdxxxxdxdxxddddolloddollll 15 | ....,ccccl,:lc,::;::o0XNOxNNxk0xlccoodddxxxdlkkkkxxxkxxxddddddddddooloolllllll 16 | .'.....,oo':c:.::,cdKko0xlWWco0Odc;;:looddllcddddddddddoooooooolllllclcccl:::c 17 | .' ........''.',':ll;':llOk:''lxl,;;;';ol:;;cdxkxoodxxdooodlclccc:;:cllclccc: 18 | ... '..;;.':,.'..'lkc.cl,'',',:c:';;,':c:,,,';;;:xocoolododl:::cc;llccc::cc:, 19 | ... ...''.','....lc;'.,;',''''cdo.cc'....'''..';c:,.';c::;;c;.',''''',''..'.. 20 | ... ...... ...',';ll;.;:,ccc:,,,,,,,'...''.'. ........,;;;;'..,....';,.. . 21 | .. ... ..''.;d,l0Kc.ox,KXXl,cl'.;ol.,;,,',. ......'....',.... ... .... 22 | .. ....,,..;''::,';;,ccc;,:lc''''.,:;;,'..;,,...... ..,,... .... 23 | ...,lxdxOdxKKd:dxlOOOl,lxddol:.,::,...,;;'.......... ....''''......'. 24 | ...,cloddxxddxxxkkkkkxxdddcdddoc;,;,. ............';::;;;;,,; 25 | ........':loooddxddddddddl;,::...;llll:::;,'...''...... .... .. ..,'..,;::; 26 | ...;coodddddddddxdddodc''.. .cooooololllllllccc:;,.............. .,::c 27 | .....,coddxxxxxxxxxxxxdol.'. .lodddddddoddoooodooolc:'';;,',;;,;;:c::;;;:cc: 28 | ......'codxkkkkkkkxxxdddolcc:, ,ddxkkxxkkxxddddddoooooolcccc:,,,,,,;::c;:c:::c 29 | ......:oodxkkkkxkxxxxdddooollc:ldxxkkkxxkxxxddoddddoooodololl;','';;;clccll::: 30 | -------------------------------------------------------------------------------- /man/jp2a.1: -------------------------------------------------------------------------------- 1 | .TH jp2a 1 "September 4, 2006" "version 1.0" "USER COMMANDS" 2 | .SH NAME 3 | jp2a \- convert JPEG images to ASCII 4 | .SH SYNOPSIS 5 | .B jp2a 6 | [ 7 | .I options 8 | ] [ 9 | .I filename(s) | URL(s) 10 | ] 11 | .LP 12 | .SH DESCRIPTION 13 | .B jp2a 14 | will convert JPEG images to ASCII characters. You can specify a mixture of files and URLs. 15 | .SH OPTIONS 16 | .TP 17 | .BI \- 18 | Read JPEG image from standard input 19 | .TP 20 | .B \-\-background=light \-\-background=dark 21 | If you don't want to mess with \-\-invert all the time, just use these instead. 22 | If you are using white characters on a black display, then use --background=dark, 23 | and vice versa. 24 | .TP 25 | .B \-b \-\-border 26 | Frame output image in a border 27 | .TP 28 | .BI \-\-chars= ... 29 | Use the given characters when producing the output ASCII image. Default is " ...',;:clodxkO0KXNWM". 30 | .TP 31 | .BI \-\-colors 32 | Use ANSI color for text output and CSS color for HTML output. 33 | .TP 34 | .B \-d \-\-debug 35 | Print debugging information when using libcurl to download images from the net. 36 | .TP 37 | .B \-f \-\-term\-fit 38 | Use the largest dimension that makes the image fit in your terminal display. 39 | .TP 40 | .B \-\-term\-height 41 | Use terminal display height and calculate width based on image aspect ratio. 42 | .TP 43 | .B \-\-term\-width 44 | Use terminal display width and calculate height based on image aspect ratio. 45 | .TP 46 | .B \-z \-\-term\-zoom 47 | Use terminal display width and height. 48 | .TP 49 | .B \-\-fill 50 | When used with \-\-html and \-\-color, then color each output character's background color. For instance, 51 | if you want to use fill-output on a light background, do 52 | 53 | jp2a --color --html --html-fill --background=light somefile.jpg --output=dark.html 54 | 55 | To do the same on a light background: 56 | 57 | jp2a --color --html --html-fill --background=dark somefile.jpg --output=light.html 58 | 59 | The default is to have fill disabled. 60 | .TP 61 | .B \-x \-\-flipx 62 | Flip output image horizontally 63 | .TP 64 | .B \-y \-\-flipy 65 | Flip output image vertically 66 | .TP 67 | .BI \-\-height= N 68 | Set output height. If only --height is specified, then output width will 69 | be calculated according to the source images aspect ratio. 70 | .TP 71 | .B \-h \-\-help 72 | Display a short help text 73 | .TP 74 | .B \-\-grayscale 75 | Converts image to grayscale when using \-\-html or \-\-colors. 76 | .TP 77 | .B \-\-html 78 | Make ASCII output in strict XHTML 1.0, suitable for viewing with web browsers. 79 | This is useful with big output dimensions, and you want to check the result with a browser with small font. 80 | .TP 81 | .B \-\-html\-fill 82 | Same as \-\-fill. You should use that option instead. 83 | .TP 84 | .B \-\-html\-no\-bold 85 | Do not use bold text for HTML output. 86 | .TP 87 | .B \-\-html\-raw 88 | Output only the image in HTML codes, leaving out the rest of the webpage, so you can construct 89 | your own. 90 | .TP 91 | .BI \-\-html\-fontsize= N 92 | Set fontsize when using \-\-html output. Default is 4. 93 | .TP 94 | .BI \-\-html\-title= ... 95 | Set HTML output title. 96 | .TP 97 | .BI \-\-output=... 98 | Write ASCII output to given filename. To explicitly specify standard output, use \-\-output=\-. 99 | .TP 100 | .B \-i \-\-invert 101 | Invert output image. If you view a picture with white background, but you are using 102 | a display with light characters on a dark background, you shoudl invert the image. 103 | .TP 104 | .BI \-\-red= ... 105 | .TP 106 | .BI \-\-green= ... 107 | .TP 108 | .BI \-\-blue= ... 109 | When converting from RGB to grayscale, use the given weights to calculate luminance. 110 | These three floating point values must add up to exactly 1.0. 111 | The default is red=0.2989, green=0.5866 and blue=0.1145. 112 | .TP 113 | .BI \-\-size= WIDTHxHEIGHT 114 | Set output dimension. 115 | .TP 116 | .B \-v \-\-verbose 117 | Print some verbose information to standard error when reading each JPEG image. 118 | .TP 119 | .BI \-\-width= N 120 | Set output width. If you only specify the width, the height will be 121 | calculated automatically. 122 | .TP 123 | .B \-V \-\-version 124 | Print program version. 125 | .TP 126 | .B \-\-zoom 127 | Sets output dimensions to your entire terminal window, disregarding source image 128 | aspect ratio. 129 | .SH RETURN VALUES 130 | jp2a returns 1 when errors are encountered, zero for no errors. 131 | .SH EXAMPLES 132 | Convert and print imagefile.jpg using ASCII characters in 40 columns and 20 rows: 133 | .PP 134 | .B jp2a 135 | \-\-size=40x20 imagefile.jpg 136 | .PP 137 | Download an image off the net, convert and print: 138 | .PP 139 | .B jp2a 140 | http://www.google.com/intl/en/logos/easter_logo.jpg 141 | .PP 142 | Output picture.jpg and picture2.jpg, each 80x25 characters, using the characters " ...ooxx@@" for output: 143 | .PP 144 | .B jp2a 145 | \-\-size=80x25 --chars=" ...ooxx@@" picture.jpg picture2.jpg 146 | .PP 147 | Output image.jpg using 76 columns, height is automatically calculated from aspect ratio of image.jpg 148 | .PP 149 | cat image.jpg | 150 | .B jp2a 151 | \-\-width=76 \- 152 | .PP 153 | If you use jp2a together with ImageMagick's convert(1) then you can make good use of pipes, 154 | and have ImageMagick do all sorts of image conversions and effects on the source image. For example: 155 | .PP 156 | .B convert 157 | somefile.png jpg:\- | 158 | .B jp2a 159 | \- \-\-width=80 160 | .PP 161 | Check out convert(1) options to see what you can do. Convert can handle almost any image format, 162 | so with this combination you can convert images in e.g. PDF or AVI files to ASCII. 163 | .PP 164 | Although the default build of jp2a includes automatic downloading of files specified by URLs, 165 | you can explicitly download them by using curl(1) or wget(1), for example: 166 | .PP 167 | .B curl 168 | \-s 169 | http://foo.bar/image.jpg | 170 | .B convert 171 | \- jpg:- | 172 | .B jp2a 173 | \- 174 | .SH DOWNLOADING IMAGES FROM THE NET 175 | If you have compiled jp2a with libcurl(3), you can download images by specifying URLs: 176 | 177 | .B jp2a 178 | https://user:pass@foo.com/bar.jpg 179 | 180 | The protocols recognized are ftp, ftps, file, http, https and tftp. 181 | 182 | If you need more control of the downloading, you should use curl(1) or wget(1) and jp2a 183 | read the image from standard input. 184 | 185 | jp2a uses pipe and fork to download images using libcurl (i.e., no exec or system calls) 186 | and therefore does not worry about malevolently formatted URLs. 187 | .SH GRAYSCALE CONVERSION 188 | You can extract the red channel by doing this: 189 | 190 | .B jp2a 191 | somefile.jpg --red=1.0 --green=0.0 --blue=0.0 192 | 193 | This will calculate luminance based on Y = R*1.0 + G*0.0 + B*0.0. The default 194 | values is to use Y = R*0.2989 + G*0.5866 + B*0.1145. 195 | .SH PROJECT HOMEPAGE 196 | The latest version of jp2a and news is always available from https://github.com/cslarsen/jp2a 197 | .SH SEE ALSO 198 | cjpeg(1), djpeg(1), jpegtran(1), convert(1) 199 | .SH BUGS 200 | jp2a does not interpolate when resizing. If you want better quality, try using convert(1) 201 | and convert the source image to the exact output dimensions before using jp2a. 202 | .PP 203 | Another issue is that jp2a skips some X-pixels along each scanline. This gives a less 204 | precise output image, and will probably be corrected in future versions. 205 | .SH AUTHOR 206 | Christian Stigen Larsen 207 | 208 | jp2a uses jpeglib to read JPEG files. jpeglib is made by The Independent JPEG Group (IJG), 209 | who have a page at http://www.ijg.org 210 | .SH LICENSE 211 | jp2a is distributed under the GNU General Public License v2. 212 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | CHANGES SINCE 1.0.7 2 | - Moved repository over to GitHub and made some corresponding changes 3 | - Reverted code to version 1.0.6 because of unfinished changes that didn't work. 4 | 5 | CHANGES SINCE 1.0.6 (svnversion 460) 6 | - Internal code changes for resizing. 7 | - Renamed `make test' to `make check'. 8 | - Some missing function signatures were added. 9 | - Using C99 keyword `restrict' in some places. 10 | 11 | CHANGES SINCE 1.0.5 (svnversion 452) 12 | - Support for GCC 2.95.4 (old C compilers in general) 13 | 14 | CHANGES SINCE 1.0.4 (svnversion 445) 15 | - Fixed problem with --invert / --background=light / --background=dark with HTML output. 16 | - Updated configure script from autoconf 2.59 to 2.60 17 | 18 | CHANGES SINCE 1.0.3 (svnversion 440) 19 | - HTML output no longer uses the ' entity. 20 | 21 | CHANGES SINCE 1.0.2 (svnversion 432) 22 | - Added option --html-no-bold to set non-bold output. 23 | - Added option to --fill ANSI background colors. 24 | - Option --html-fill is now same as --fill and will be phased out. 25 | - Default HTML font changed from courier new to courier. 26 | - HTML output always uses
 tag.
 27 | 
 28 | CHANGES SINCE 1.0.1 (svnversion 427)
 29 | - Using span- instead of b-tags in HTML output.
 30 | 
 31 | CHANGES SINCE 1.0.0 (svnversion 421)
 32 | - Added option --html-title=...
 33 | - Added option --html-raw
 34 | 
 35 | CHANGES SINCE 0.9.22
 36 | - License changed from "GPL v2 or later" to "GPL v2".  This is just because
 37 |   I want to review the v3 license before deciding to apply it to jp2a, as it
 38 |   might require me to add things to the program.
 39 | - Minor code changes (in image.c)
 40 | - Distribution now also contains HTML manual pages for systems that do not support UNIX man.
 41 | - Version bumped to 1.0.0 (stable)
 42 | 
 43 | CHANGES SINCE 0.9.21 (rev. 412)
 44 | - Text color output is a bit more colorful.
 45 | - HTML-output is now Firefox-friendly.
 46 | - Added --html-fill to enable/disable background colors on HTML output.
 47 | - Options --background=light or =dark now affects HTML output background.
 48 | 
 49 | CHANGES SINCE 0.9.20
 50 | - Added color output for text (ANSI colors) and HTML (CSS colors).
 51 | - Changed default HTML fontsize from 4 to 8 pt.
 52 | - Fixed a bug that produced incorrect output when using --output and --html.
 53 | - Fixed a bug that gave incorret --term-fit when vieweing multiple files.
 54 | 
 55 | CHANGES SINCE 0.9.19
 56 | - A bash script is used for testing now.
 57 | - The tests were updated to use --width=78 (the old default) where appropriate.
 58 | - Cygwin support was added.
 59 | - term.h is now also sought in ncurses/term.h (for Cygwin support).
 60 | - The help text was shrunk.
 61 | 
 62 | CHANGES SINCE 0.9.18
 63 | - Default running mode is now "jp2a --term-fit" if you have --enable-termlib (which is also default).
 64 | - New options --term-fit, --term-width, --term-height to automatically fit image to terminal display.
 65 | - New options --background=dark and --background=light so you don't have to bother with --invert.
 66 | - Much better output quality as all source pixels are now read.
 67 | - Configure now accepts --enable-termlib (default) or --disable-termlib.
 68 | - Bugfix: In some cases, the last pixel(s) of the source images were not read.
 69 | - Will now gracefully exit if jpeg color precision is other than 8 bits per channels.
 70 | 
 71 | CHANGES SINCE 0.9.17
 72 | - Bugfix:  No more crashes when reading non-JPEG files on Windows.
 73 | - New option: --output=file, send output to given file
 74 | - New options: -x for shorthand --flipx, and -y for --flipy.
 75 | - New options: --red, --green, --blue.
 76 | - More natural RGB to Grayscale calculation.
 77 | - Updated manuals.
 78 | - Cleaner code.
 79 | - Faster code (most evident in large images).
 80 | 
 81 | CHANGES SINCE 0.9.16
 82 | - New feature: Download-support on win32 binary builds.
 83 | - Added option to --clear screen before writing each output image.
 84 | - Updated tests for win32 cygwin environment (but still incomplete).
 85 | 
 86 | CHANGES SINCE 0.9.15 AND 0.9.14 
 87 | - New feature:  Now follow HTTP redirects when downloading.
 88 | - Cleaner and faster code.
 89 | - Cleaner package organization.
 90 | - Improved `make test'.
 91 | - Binary is larger becase of debug-symbols; remove with `make install-strip'.
 92 | - Added HTML-manual for win32 binary distribution.
 93 | 
 94 | CHANGES SINCE 0.9.13
 95 | - Minor bugfix: --chars now correctly accepts minimum two chars.
 96 | - Changed package layout (added src/ and tests/).
 97 | - Added `make test' target.
 98 | 
 99 | CHANGES SINCE 0.9.12
100 | - Bugfix: Fixed bug when viewing several files (in clear(), yadds wasn't completely cleared)
101 | - Minor code cleanup.
102 | 
103 | CHANGES SINCE 0.9.11
104 | - Some Linux build failed on this:  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
105 |   This has been removed, and works well for the Linux distro tested on.
106 | 
107 | CHANGES SINCE 0.9.10
108 | - New feature:  Can now download images from URLs (requires libcurl)
109 | - New feature:  Added --debug (-d) for debug output with libcurl
110 | - configure:    Added --enable-curl and --with-curl-config=PATH
111 | 
112 | CHANGES SINCE 0.9.9
113 | - Using both --width and --height is equivalent to using --size
114 | - Now correctly calculates width and height if one of --width or --height is used
115 | 
116 | CHANGES SINCE 0.9.8
117 | - New feature: Added --flipx and --flipy options to flip the output image.
118 | - New feature: Added --html and --html-fontsize for XHTML 1.0 output.
119 | - Bugfix: The bugfix from 0.9.6 sneaked back into the 0.9.8 release, and is now removed.
120 | - Code changes: The code is a little bit cleaner, and faster now for big output dimensions
121 | - Added reference to The Independent JPEG Group in the man page, as the libjpeg license requires that.
122 | - The help text now fits inside 80 characters in width.
123 | - Default mode changed from --width=70 to --width=78
124 | 
125 | CHANGES SINCE 0.9.7
126 | - Minor portability issues resolved (regarding size_t usage)
127 | - Moved some redundant help text to the man page
128 | - Updated and expanded man page
129 | 
130 | CHANGES SINCE 0.9.6
131 | - Minor bugfix, for some images, the last output line would be a "black" line,
132 |   this has been fixed with the use of ROUND in dst_y calculations.
133 | 
134 | CHANGES SINCE 0.9.5
135 | - Fixed a major bug in the clear() function that overwrote the yadds buffer.
136 |   The program should work much better now, especially on multiple input files.
137 | 
138 | CHANGES SINCE 0.9.4
139 | - The option --border can now be specified simply as -b
140 | - New option --invert or -i to invert output image
141 | 
142 | CHANGES SINCE 0.9.3
143 | - jp2a now exits with error when no files are specified
144 | - Function signatures changed; added const where applicable
145 | - Reintroduced use of malloc
146 | - Added check for alloca in configure.ac
147 | 
148 | CHANGES SINCE 0.9.2
149 | - When reading multiple files, malloc complained when freeing memory.  Using
150 |   alloca now instead, which does not complain (although it may seem a buffer
151 |   overrun is lurking somewhere).
152 | - Not using exit(), using return codes.  If error occurs, we always stop.
153 | - Using `cat file.jpg | jp2a -' now does not print help message along with
154 |   image.
155 | 
156 | CHANGES SINCE 0.9.1
157 | - Much better output results, due to more accurate normalization and removal of
158 |   missing scanlines in output image.
159 | - Default mode is now "--width=70" instead of "--size=80x25", as this preserves
160 |   JPEG aspect ratio in output.
161 | - Configure does not check for memset function anymore
162 | - to_dst_x and to_dst_y are now correct
163 | 
164 | CHANGES SINCE 0.9.0
165 | - Added --border option
166 | - Fixed buffer overrun bug when using big output dimensions
167 | - Minor code cleanup
168 | - Note that to_dst_x and to_dst_y in code might be wrong
169 | 


--------------------------------------------------------------------------------
/tests/160x49.txt:
--------------------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MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
 8 | MMMMMMMMMMMMMWNNNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNNNNNNWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
 9 | MMMMMMMMMMMXOdcc:ld0WWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNX0xdlccc:::ccldk0XWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
10 | MMMMMMMMMNXo..     ;dKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNXXOoc;'.            .':lkXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
11 | MMMMMMMMMKd,        .dMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWKkl;;.                     .:xXWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
12 | MMMMMMMMM0d'        .dMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNo.                           .cOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
13 | MMMMMMMMMNKl.      ,o0MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNX:                              cKNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
14 | MMMMMMMMMMMKxo:::ldONWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNXc         ......               .cOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
15 | MMMMMMMMWX000OkkkO000KNWMMMMMWNK00000000000XMMWNK0kxxxxxkOKXWWMMMMMMMMMMMMMNX:     .;loxkOkkxo;.            ..dMMMMMMMMMMMMMMMWWNXKOkxxxxxxxxkO0XNWMMMMMMMMMMMMM
16 | MMMMMMMWNd'''''''''''ckKMMMMMXOl'''''''''''dXkoc,'........,;cdOXMMMMMMMMMMMNKc .;;oOKWMMMMMMMW0d,            .dMMMMMMMMMMMWX0xoc:;,............';:ox0WWMMMMMMMMM
17 | MMMMMMMWXc           'd0MMMMMKx,           .;.               ..:d0WMMMMMMMMNXkckXXNMMMMMMMMMMMWWo.           .dMMMMMMMMWKxl;'.                     .,lOWWMMMMMMM
18 | MMMMMMMWXc           'd0MMMMMKk,                                .;xKMMMMMMMWWNNWMMMMMMMMMMMMMMMMx'.         .'xMMMMMMMWNl.                            ,d0MMMMMMM
19 | MMMMMMMWXc           'd0MMMMMKx,                                  .lKNMMMMMMMMMMMMMMMMMMMMMMMMMMd.          .lOMMMMMMMNX:        ..'',,,'..            .dWMMMMMM
20 | MMMMMMMWXc           'd0MMMMMKx,             .';:cc;'.             .cOMMMMMMMMMMMMMMMMMMMMMMMMWNl           cKNMMMMMMMNXc    .,coxk00KKK0Ol'.           cXWMMMMM
21 | MMMMMMMWXc           'd0MMMMMKx,           'lx0XNNNX0dc.            .oWMMMMMMMMMMMMMMMMMMMMMMMKk;         .,xMMMMMMMMMNKc .,lkKWWMMMMMMMMMKk,           :0NMMMMM
22 | MMMMMMMWXc           'd0MMMMMKx,           lNWMMMMMMMWNo.            cKNMMMMMMMMMMMMMMMMMMMMWWd'.         :0XMMMMMMMMMWXkcxKNMMMMMMMMMWNXKxl'           ;0XMMMMM
23 | MMMMMMMWXc           'd0MMMMMKx,           lWWMMMMMMMMMOc.           ;kXMMMMMMMMMMMMMMMMMMMMKd,         .lOMMMMMMMMMMMMWWNWMMMMMWNX0kdlc;,.             ;0XMMMMM
24 | MMMMMMMWXc           'd0MMMMMKx,           lWWMMMMMMMMMKk,           ,dKMMMMMMMMMMMMMMMMMMN0c.        ..oNWMMMMMMMMMMMMMMMMMWX0xoc;'.                   ;0XMMMMM
25 | MMMMMMMWXc           'd0MMMMMKx,           lWWMMMMMMMMM0d'           ,kKMMMMMMMMMMMMMMWNOd;.        .:dKNMMMMMMMMMMMMMMMXOdc;..       .,:llo'           ;0XMMMMM
26 | MMMMMMMWXc           'd0MMMMMKx,           lWMMMMMMMMWWd.            cXWMMMMMMMMMMMMWWkc.         .:xNNNNNNNNNNNNWWMMMNKc.          ;xKWWMNK:           ;0XMMMMM
27 | MMMMMMMWXc           'd0MMMMMKx,           ;x0NWMMMWNOo'            .dWMMMMMMMMMMMMW0o'           .,;c::::::::::ld0MMMOl'         .'xMMMMMNK:           :0NMMMMM
28 | MMMMMMMWXc           'd0MMMMMKx,            .':loddlc'             'l0MMMMMMMMMMMMKx;                           .'xMMMx,.         .'xMMMMWKx,           ,dOXK0NM
29 | MMMMMMMWXc           'd0MMMMMKx,                                  .lXWMMMMMMMMMXOOc.                            .'xMMMk;.           ;dxkdl;.             .,;::kM
30 | MMMMMMMWXc           'd0MMMMMKx,                                 ;xKMMMMMMMMMX0l..                              .'xMMMKx,             ...                    .dM
31 | MMMMMMMWXc           'd0MMMMMKx,                              .;d0WMMMMMMMMX0l'.                                ..xMMMWNd'.               ....              .,xM
32 | MMMMMMMNXc           'd0MMMMMKx,           ,oc,..        ..,:okKWMMMMMMMMMMOl;..'''''''''''''''''''''''''''''''',:OMMMMMX0o;'..       ..,cdOkk:..      ..';cdkXM
33 | MMMMMMMNK:           'd0MMMMMKk,           lWNKOxddddddddxkKNWMMMMMMMMMMMMMX00OO000000000000000000000000000000000KNMMMMMMMWX0xxdddddddxOKNWMMMKkxddddddxk0KNWMMM
34 | MMMMMMMKx,           ,dKMMMMMKx,           lWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
35 | MMMWWKOl.            ;OXMMMMMKx,           lWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
36 | MMMXOc..             lNWMMMMMKx,           lWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
37 | MMMXO;             .,kMMMMMMMKx,           lWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
38 | MMMWWd.           .c0NMMMMMMMKx,           lWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
39 | MMMMMKd,        .:xKMMMMMMMMMKx,           lWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
40 | MMMMMWNo.. ..':okKMMMMMMMMMMMXk:...........oWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
48 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
49 | MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
50 | 


--------------------------------------------------------------------------------
/LICENSES:
--------------------------------------------------------------------------------
  1 | jp2a is distributed under the GNU General Public License v2.  See the file
  2 | COPYING for a copy of that license, and how you can apply that license to make
  3 | derivative works.
  4 | 
  5 | Although I do make use of other libraries, the source distribution does not
  6 | include any source-code from these.  However, the win32 version comes with
  7 | precompiled library files, so I copy the licenses here.
  8 | 
  9 | jp2a makes use of the JPEG library by the Independent JPEG Group.  See
 10 | http://www.ijg.org
 11 | 
 12 | jp2a makes use of libcurl, which has the following license:
 13 | 
 14 |     COPYRIGHT AND PERMISSION NOTICE
 15 | 
 16 |     Copyright (c) 1996 - 2006, Daniel Stenberg, .
 17 | 
 18 |     All rights reserved.
 19 | 
 20 |     Permission to use, copy, modify, and distribute this software for any purpose
 21 |     with or without fee is hereby granted, provided that the above copyright notice
 22 |     and this permission notice appear in all copies.
 23 | 
 24 |     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 25 |     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 26 |     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
 27 |     NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 28 |     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 29 |     OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
 30 |     OR OTHER DEALINGS IN THE SOFTWARE.
 31 | 
 32 |     Except as contained in this notice, the name of a copyright holder shall
 33 |     not be used in advertising or otherwise to promote the sale, use or other
 34 |     dealings in this Software without prior written authorization of the
 35 |     copyright holder.
 36 | 
 37 | The jp2a win32 binary distribution comes with zlib1.dll from
 38 | http://www.zlib.org.  The zlib license is as follows:
 39 | 
 40 |     /* zlib.h -- interface of the 'zlib' general purpose compression library
 41 |       version 1.2.3, July 18th, 2005
 42 | 
 43 |       Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
 44 | 
 45 |       This software is provided 'as-is', without any express or implied
 46 |       warranty.  In no event will the authors be held liable for any damages
 47 |       arising from the use of this software.
 48 | 
 49 |       Permission is granted to anyone to use this software for any purpose,
 50 |       including commercial applications, and to alter it and redistribute it
 51 |       freely, subject to the following restrictions:
 52 | 
 53 |       1. The origin of this software must not be misrepresented; you must not
 54 |          claim that you wrote the original software. If you use this software
 55 |          in a product, an acknowledgment in the product documentation would be
 56 |          appreciated but is not required.
 57 |       2. Altered source versions must be plainly marked as such, and must not be
 58 |          misrepresented as being the original software.
 59 |       3. This notice may not be removed or altered from any source distribution.
 60 | 
 61 |       Jean-loup Gailly jloup@gzip.org
 62 |       Mark Adler madler@alumni.caltech.edu
 63 | 
 64 |     */
 65 | 
 66 | The jp2a win32 binary distribution comes with precompiled OpenSSL binaries from
 67 | http://www.openssl.org.  These have the following license:
 68 | 
 69 |       LICENSE ISSUES
 70 |       ==============
 71 | 
 72 |       The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
 73 |       the OpenSSL License and the original SSLeay license apply to the toolkit.
 74 |       See below for the actual license texts. Actually both licenses are BSD-style
 75 |       Open Source licenses. In case of any license issues related to OpenSSL
 76 |       please contact openssl-core@openssl.org.
 77 | 
 78 |       OpenSSL License
 79 |       ---------------
 80 | 
 81 |     /* ====================================================================
 82 |      * Copyright (c) 1998-2005 The OpenSSL Project.  All rights reserved.
 83 |      *
 84 |      * Redistribution and use in source and binary forms, with or without
 85 |      * modification, are permitted provided that the following conditions
 86 |      * are met:
 87 |      *
 88 |      * 1. Redistributions of source code must retain the above copyright
 89 |      *    notice, this list of conditions and the following disclaimer.
 90 |      *
 91 |      * 2. Redistributions in binary form must reproduce the above copyright
 92 |      *    notice, this list of conditions and the following disclaimer in
 93 |      *    the documentation and/or other materials provided with the
 94 |      *    distribution.
 95 |      *
 96 |      * 3. All advertising materials mentioning features or use of this
 97 |      *    software must display the following acknowledgment:
 98 |      *    "This product includes software developed by the OpenSSL Project
 99 |      *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
100 |      *
101 |      * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
102 |      *    endorse or promote products derived from this software without
103 |      *    prior written permission. For written permission, please contact
104 |      *    openssl-core@openssl.org.
105 |      *
106 |      * 5. Products derived from this software may not be called "OpenSSL"
107 |      *    nor may "OpenSSL" appear in their names without prior written
108 |      *    permission of the OpenSSL Project.
109 |      *
110 |      * 6. Redistributions of any form whatsoever must retain the following
111 |      *    acknowledgment:
112 |      *    "This product includes software developed by the OpenSSL Project
113 |      *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
114 |      *
115 |      * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
116 |      * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
117 |      * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
118 |      * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
119 |      * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
120 |      * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
121 |      * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
122 |      * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
123 |      * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
124 |      * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
125 |      * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
126 |      * OF THE POSSIBILITY OF SUCH DAMAGE.
127 |      * ====================================================================
128 |      *
129 |      * This product includes cryptographic software written by Eric Young
130 |      * (eay@cryptsoft.com).  This product includes software written by Tim
131 |      * Hudson (tjh@cryptsoft.com).
132 |      *
133 |      */
134 | 
135 |      Original SSLeay License
136 |      -----------------------
137 | 
138 |     /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
139 |      * All rights reserved.
140 |      *
141 |      * This package is an SSL implementation written
142 |      * by Eric Young (eay@cryptsoft.com).
143 |      * The implementation was written so as to conform with Netscapes SSL.
144 |      *
145 |      * This library is free for commercial and non-commercial use as long as
146 |      * the following conditions are aheared to.  The following conditions
147 |      * apply to all code found in this distribution, be it the RC4, RSA,
148 |      * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
149 |      * included with this distribution is covered by the same copyright terms
150 |      * except that the holder is Tim Hudson (tjh@cryptsoft.com).
151 |      *
152 |      * Copyright remains Eric Young's, and as such any Copyright notices in
153 |      * the code are not to be removed.
154 |      * If this package is used in a product, Eric Young should be given attribution
155 |      * as the author of the parts of the library used.
156 |      * This can be in the form of a textual message at program startup or
157 |      * in documentation (online or textual) provided with the package.
158 |      *
159 |      * Redistribution and use in source and binary forms, with or without
160 |      * modification, are permitted provided that the following conditions
161 |      * are met:
162 |      * 1. Redistributions of source code must retain the copyright
163 |      *    notice, this list of conditions and the following disclaimer.
164 |      * 2. Redistributions in binary form must reproduce the above copyright
165 |      *    notice, this list of conditions and the following disclaimer in the
166 |      *    documentation and/or other materials provided with the distribution.
167 |      * 3. All advertising materials mentioning features or use of this software
168 |      *    must display the following acknowledgement:
169 |      *    "This product includes cryptographic software written by
170 |      *     Eric Young (eay@cryptsoft.com)"
171 |      *    The word 'cryptographic' can be left out if the rouines from the library
172 |      *    being used are not cryptographic related :-).
173 |      * 4. If you include any Windows specific code (or a derivative thereof) from
174 |      *    the apps directory (application code) you must include an acknowledgement:
175 |      *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
176 |      *
177 |      * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
178 |      * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
179 |      * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
180 |      * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
181 |      * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
182 |      * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
183 |      * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
184 |      * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
185 |      * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
186 |      * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
187 |      * SUCH DAMAGE.
188 |      *
189 |      * The licence and distribution terms for any publically available version or
190 |      * derivative of this code cannot be changed.  i.e. this code cannot simply be
191 |      * copied and put under another distribution licence
192 |      * [including the GNU Public Licence.]
193 |      */
194 | 


--------------------------------------------------------------------------------
/src/options.c:
--------------------------------------------------------------------------------
  1 | /*
  2 |  * Copyright 2006-2016 Christian Stigen Larsen
  3 |  * Distributed under the GNU General Public License (GPL) v2.
  4 |  */
  5 | 
  6 | #ifdef HAVE_CONFIG_H
  7 | #include "config.h"
  8 | #endif
  9 | 
 10 | #include 
 11 | 
 12 | #ifdef HAVE_STRING_H
 13 | #include 
 14 | #endif
 15 | 
 16 | #ifdef HAVE_STDLIB_H
 17 | #include 
 18 | #endif
 19 | 
 20 | #ifdef HAVE_CURSES_H
 21 | #include 
 22 | #endif
 23 | 
 24 | #ifdef HAVE_TERM_H
 25 | #include 
 26 | #endif
 27 | 
 28 | #include "jp2a.h"
 29 | #include "options.h"
 30 | 
 31 | // Default options
 32 | int verbose = 0;
 33 | int auto_height = 1;
 34 | int auto_width = 0;
 35 | 
 36 | int width =
 37 | #ifdef FEAT_TERMLIB
 38 |  0;
 39 | #else
 40 |  78;
 41 | #endif
 42 | 
 43 | int height = 0;
 44 | int use_border = 0;
 45 | int invert = 1;
 46 | int flipx = 0;
 47 | int flipy = 0;
 48 | int html = 0;
 49 | int colorfill = 0;
 50 | int convert_grayscale = 0;
 51 | int html_fontsize = 8;
 52 | int html_bold = 1;
 53 | const char* html_title = "jp2a converted image";
 54 | int html_rawoutput = 0;
 55 | int debug = 0;
 56 | int clearscr = 0;
 57 | int term_width = 0;
 58 | int term_height = 0;
 59 | int usecolors = 0;
 60 | 
 61 | int termfit =
 62 | #ifdef FEAT_TERMLIB
 63 |  TERM_FIT_AUTO;
 64 | #else
 65 |  0;
 66 | #endif
 67 | 
 68 | #define ASCII_PALETTE_SIZE 256
 69 | char ascii_palette[ASCII_PALETTE_SIZE + 1] = "   ...',;:clodxkO0KXNWM";
 70 | 
 71 | // Default weights, must add up to 1.0
 72 | float redweight = 0.2989f;
 73 | float greenweight = 0.5866f;
 74 | float blueweight = 0.1145f;
 75 | 
 76 | // calculated in parse_options
 77 | float RED[256], GREEN[256], BLUE[256], GRAY[256];
 78 | 
 79 | const char *fileout = "-"; // stdout
 80 | 
 81 | const char* version   = PACKAGE_STRING;
 82 | const char* copyright = "Copyright 2006-2016 Christian Stigen Larsen";
 83 | const char* license   = "Distributed under the GNU General Public License (GPL) v2.";
 84 | const char* url       = "https://github.com/cslarsen/jp2a";
 85 | 
 86 | void print_version() {
 87 | 	fprintf(stderr, "%s\n%s\n%s\n", version, copyright, license);
 88 | }
 89 | 
 90 | void help() {
 91 | 	print_version();
 92 | 
 93 | 	fputs(
 94 | "\n"
 95 | #ifdef FEAT_CURL
 96 | "Usage: jp2a [ options ] [ file(s) | URL(s) ]\n\n"
 97 | 
 98 | "Convert files or URLs from JPEG format to ASCII.\n\n"
 99 | #else
100 | "Usage: jp2a [ options ] [ file(s) ]\n\n"
101 | 
102 | "Convert files in JPEG format to ASCII.\n\n"
103 | #endif
104 | "OPTIONS\n"
105 | "  -                 Read images from standard input.\n"
106 | "      --blue=N.N    Set RGB to grayscale conversion weight, default is 0.1145\n"
107 | "  -b, --border      Print a border around the output image.\n"
108 | "      --chars=...   Select character palette used to paint the image.\n"
109 | "                    Leftmost character corresponds to black pixel, right-\n"
110 | "                    most to white.  Minimum two characters must be specified.\n"
111 | "      --clear       Clears screen before drawing each output image.\n"
112 | "      --colors      Use ANSI colors in output.\n"
113 | "  -d, --debug       Print additional debug information.\n"
114 | "      --fill        When used with --color and/or --html, color each character's\n"
115 | "                    background color.\n"
116 | "  -x, --flipx       Flip image in X direction.\n"
117 | "  -y, --flipy       Flip image in Y direction.\n"
118 | #ifdef FEAT_TERMLIB
119 | "  -f, --term-fit    Use the largest image dimension that fits in your terminal\n"
120 | "                    display with correct aspect ratio.\n"
121 | "      --term-height Use terminal display height.\n"
122 | "      --term-width  Use terminal display width.\n"
123 | "  -z, --term-zoom   Use terminal display dimension for output.\n"
124 | #endif
125 | "      --grayscale   Convert image to grayscale when using --html or --colors\n"
126 | "      --green=N.N   Set RGB to grayscale conversion weight, default is 0.5866\n"
127 | "      --height=N    Set output height, calculate width from aspect ratio.\n"
128 | "  -h, --help        Print program help.\n"
129 | "      --html        Produce strict XHTML 1.0 output.\n"
130 | "      --html-fill   Same as --fill (will be phased out)\n"
131 | "      --html-fontsize=N   Set fontsize to N pt, default is 4.\n"
132 | "      --html-no-bold      Do not use bold characters with HTML output\n"
133 | "      --html-raw    Output raw HTML codes, i.e. without the  section etc.\n"
134 | "      --html-title=...  Set HTML output title\n"
135 | "  -i, --invert      Invert output image.  Use if your display has a dark\n"
136 | "                    background.\n"
137 | "      --background=dark   These are just mnemonics whether to use --invert\n"
138 | "      --background=light  or not.  If your console has light characters on\n"
139 | "                    a dark background, use --background=dark.\n"
140 | "      --output=...  Write output to file.\n"
141 | "      --red=N.N     Set RGB to grayscale conversion weight, default 0.2989f.\n"
142 | "      --size=WxH    Set output width and height.\n"
143 | "  -v, --verbose     Verbose output.\n"
144 | "  -V, --version     Print program version.\n"
145 | "      --width=N     Set output width, calculate height from ratio.\n"
146 | "\n"
147 | #ifdef FEAT_TERMLIB
148 | "  The default mode is `jp2a --term-fit --background=dark'.\n"
149 | #else
150 | "  The default mode is `jp2a --width=78 --background=dark'.\n"
151 | #endif
152 | "  See the man-page for jp2a for more detailed help text.\n"
153 | "\n", stderr);
154 | 
155 | 	fprintf(stderr, "Project homepage on %s\n", url);
156 | 	fprintf(stderr, "Report bugs to <%s>\n", PACKAGE_BUGREPORT);
157 | }
158 | 
159 | void precalc_rgb(const float red, const float green, const float blue) {
160 | 	int n;
161 | 	for ( n=0; n<256; ++n ) {
162 | 		RED[n]   = ((float) n) * red / 255.0f;
163 | 		GREEN[n] = ((float) n) * green / 255.0f;
164 | 		BLUE[n]  = ((float) n) * blue / 255.0f;
165 | 		GRAY[n]  = ((float) n) / 255.0f;
166 | 	}
167 | }
168 | 
169 | void parse_options(int argc, char** argv) {
170 | 	// make code more readable
171 | 	#define IF_OPTS(sopt, lopt)     if ( !strcmp(s, sopt) || !strcmp(s, lopt) )
172 | 	#define IF_OPT(sopt)            if ( !strcmp(s, sopt) )
173 | 	#define IF_VARS(format, v1, v2) if ( sscanf(s, format, v1, v2) == 2 )
174 | 	#define IF_VAR(format, v1)      if ( sscanf(s, format, v1) == 1 )
175 | 
176 | 	int n, files, fit_to_use;
177 | 
178 | 	for ( n=1, files=0; n
 12 | #undef HAVE_STDLIB_H
 13 | #endif
 14 | 
 15 | #include 
 16 | 
 17 | #ifdef HAVE_STRING_H
 18 | #include 
 19 | #endif
 20 | 
 21 | #include "jpeglib.h"
 22 | 
 23 | #include "aspect_ratio.h"
 24 | #include "image.h"
 25 | #include "jp2a.h"
 26 | #include "options.h"
 27 | 
 28 | #define ROUND(x) (int) ( 0.5f + x )
 29 | 
 30 | typedef struct Image_ {
 31 | 	int width;
 32 | 	int height;
 33 | 	float *pixel; // luminosity
 34 | 	float *red, *green, *blue;
 35 | 	int *yadds;
 36 | 	float resize_y;
 37 | 	float resize_x;
 38 | 	int *lookup_resx;
 39 | } Image;
 40 | 
 41 | void print_border(const int width) {
 42 | 	#ifndef HAVE_MEMSET
 43 | 	int n;
 44 | 	#endif
 45 | 
 46 | 	#ifdef WIN32
 47 | 	char *bord = (char*) malloc(width+3);
 48 | 	#else
 49 | 	char bord[width + 3];
 50 | 	#endif
 51 | 
 52 | 	#ifdef HAVE_MEMSET
 53 | 	memset(bord, '-', width+2);
 54 | 	#else
 55 | 	for ( n=0; nheight; ++y ) {
 73 | 
 74 | 		if ( use_border ) fprintf(f, "|");
 75 | 
 76 | 		xstart = 0;
 77 | 		xend   = i->width;
 78 | 		xincr  = 1;
 79 | 
 80 | 		if ( flipx ) {
 81 | 			xstart = i->width - 1;
 82 | 			xend = -1;
 83 | 			xincr = -1;
 84 | 		}
 85 | 
 86 | 		for ( x=xstart; x != xend; x += xincr ) {
 87 | 
 88 | 			float Y = i->pixel[x + (flipy? i->height - y - 1 : y ) * i->width];
 89 | 			float Y_inv = 1.0f - Y;
 90 | 			float R = i->red  [x + (flipy? i->height - y - 1 : y ) * i->width];
 91 | 			float G = i->green[x + (flipy? i->height - y - 1 : y ) * i->width];
 92 | 			float B = i->blue [x + (flipy? i->height - y - 1 : y ) * i->width];
 93 | 
 94 | 			const int pos = ROUND((float)chars * (!invert? Y_inv : Y));
 95 | 			char ch = ascii_palette[pos];
 96 | 
 97 | 			const float min = 1.0f / 255.0f;
 98 | 
 99 | 			if ( !html ) {
100 | 				const float t = 0.1f; // threshold
101 | 				const float i = 1.0f - t;
102 | 
103 | 				int colr = 0;
104 | 				int highl = 0;
105 | 
106 | 				// ANSI highlite, only use in grayscale
107 | 			        if ( Y>=0.95f && RG && R-t>B )            colr = 31; // red
111 | 				else if ( G-t>R && G-t>B )            colr = 32; // green
112 | 				else if ( R-t>B && G-t>B && R+G>i )   colr = 33; // yellow
113 | 				else if ( B-t>R && B-t>G && Y<0.95f ) colr = 34; // blue
114 | 				else if ( R-t>G && B-t>G && R+B>i )   colr = 35; // magenta
115 | 				else if ( G-t>R && B-t>R && B+G>i )   colr = 36; // cyan
116 | 				else if ( R+G+B>=3.0f*Y )             colr = 37; // white
117 | 				} else {
118 | 					if ( Y>=0.7f ) { highl=1; colr = 37; }
119 | 				}
120 | 
121 | 				if ( !colr ) {
122 | 					if ( !highl ) fprintf(f, "%c", ch);
123 | 					else          fprintf(f, "%c[1m%c%c[0m", 27, ch, 27);
124 | 				} else {
125 | 					if ( colorfill ) colr += 10;          // set to ANSI background color
126 | 					fprintf(f, "%c[%dm%c", 27, colr, ch); // ANSI color
127 | 					fprintf(f, "%c[0m", 27);              // ANSI reset
128 | 				}
129 | 
130 | 			} else {  // HTML output
131 | 			
132 | 				// either --grayscale is specified (convert_grayscale)
133 | 				// or we can see that the image is inherently a grayscale image	
134 | 				if ( convert_grayscale || (Rmin) ) {
135 | 					// Grayscale image
136 | 					if ( colorfill )
137 | 						print_html_char(f, ch,
138 | 							ROUND(255.0f*Y*0.5f), ROUND(255.0f*Y*0.5f), ROUND(255.0f*Y*0.5f),
139 | 							ROUND(255.0f*Y),      ROUND(255.0f*Y),      ROUND(255.0f*Y));
140 | 					else
141 | 						print_html_char(f, ch,
142 | 							ROUND(255.0f*Y), ROUND(255.0f*Y), ROUND(255.0f*Y),
143 | 							255, 255, 255);
144 | 				} else {
145 | 					if ( colorfill )
146 | 						print_html_char(f, ch,
147 | 							ROUND(255.0f*Y*R), ROUND(255.0f*Y*G), ROUND(255.0f*Y*B),
148 | 							ROUND(255.0f*R),   ROUND(255.0f*G),   ROUND(255.0f*B));
149 | 					else
150 | 						print_html_char(f, ch,
151 | 							ROUND(255.0f*R), ROUND(255.0f*G), ROUND(255.0f*B),
152 | 							255, 255, 255);
153 | 				}
154 | 			}
155 | 		}
156 | 
157 | 		if ( use_border )
158 | 			fputc('|', f);
159 | 
160 | 		if ( html )
161 | 			print_html_newline(f);
162 | 		else
163 | 			fputc('\n', f);
164 | 	}
165 | }
166 | 
167 | void print_image(const Image* const i, const int chars, FILE *f) {
168 | 	int x, y;
169 | 
170 | 	#ifdef WIN32
171 | 	char *line = (char*) malloc(i->width + 1);
172 | 	#else
173 | 	char line[i->width + 1];
174 | 	#endif
175 | 
176 | 	line[i->width] = 0;
177 | 
178 | 	for ( y=0; y < i->height; ++y ) {
179 | 
180 | 		for ( x=0; x < i->width; ++x ) {
181 | 
182 | 			const float lum = i->pixel[x + (flipy? i->height - y - 1 : y) * i->width];
183 | 			const int pos = ROUND((float)chars * lum);
184 | 
185 | 			line[flipx? i->width - x - 1 : x] = ascii_palette[invert? pos : chars - pos];
186 | 		}
187 | 
188 | 		fprintf(f, !use_border? "%s\n" : "|%s|\n", line);
189 | 	}
190 | 
191 | 	#ifdef WIN32
192 | 	free(line);
193 | 	#endif
194 | }
195 | 
196 | void clear(Image* i) {
197 | 	memset(i->yadds, 0, i->height * sizeof(int) );
198 | 	memset(i->pixel, 0, i->width * i->height * sizeof(float));
199 | 	memset(i->lookup_resx, 0, (1 + i->width) * sizeof(int) );
200 | 
201 | 	if ( usecolors ) {
202 | 		memset(i->red,   0, i->width * i->height * sizeof(float));
203 | 		memset(i->green, 0, i->width * i->height * sizeof(float));
204 | 		memset(i->blue,  0, i->width * i->height * sizeof(float));
205 | 	}
206 | }
207 | 
208 | void normalize(Image* i) {
209 | 
210 | 	float *pixel = i->pixel;
211 | 	float *red   = i->red;
212 | 	float *green = i->green;
213 | 	float *blue  = i->blue;
214 | 
215 | 	int x, y;
216 | 
217 | 	for ( y=0; y < i->height; ++y ) {
218 | 
219 | 		if ( i->yadds[y] > 1 ) {
220 | 
221 | 			for ( x=0; x < i->width; ++x ) {
222 | 				pixel[x] /= i->yadds[y];
223 | 
224 | 				if ( usecolors ) {
225 | 					red  [x] /= i->yadds[y];
226 | 					green[x] /= i->yadds[y];
227 | 					blue [x] /= i->yadds[y];
228 | 				}
229 | 			}
230 | 		}
231 | 
232 | 		pixel += i->width;
233 | 
234 | 		if ( usecolors ) {
235 | 			red   += i->width;
236 | 			green += i->width;
237 | 			blue  += i->width;
238 | 		}
239 | 	}
240 | }
241 | 
242 | void print_progress(const struct jpeg_decompress_struct* jpg) {
243 | 	float progress;
244 | 	int pos;
245 | 	#define BARLEN 56
246 | 
247 | 	static char s[BARLEN];
248 | 	s[BARLEN-1] = 0;
249 | 
250 |  	progress = (float) (jpg->output_scanline + 1.0f) / (float) jpg->output_height;
251 | 	pos = ROUND( (float) (BARLEN-2) * progress );
252 | 
253 | 	memset(s, '.', BARLEN-2);
254 | 	memset(s, '#', pos);
255 | 
256 | 	fprintf(stderr, "Decompressing image [%s]\r", s);
257 | 	fflush(stderr);
258 | }
259 | 
260 | void print_info(const struct jpeg_decompress_struct* jpg) {
261 | 	fprintf(stderr, "Source width: %d\n", jpg->output_width);
262 | 	fprintf(stderr, "Source height: %d\n", jpg->output_height);
263 | 	fprintf(stderr, "Source color components: %d\n", jpg->output_components);
264 | 	fprintf(stderr, "Output width: %d\n", width);
265 | 	fprintf(stderr, "Output height: %d\n", height);
266 | 	fprintf(stderr, "Output palette (%d chars): '%s'\n", (int)strlen(ascii_palette), ascii_palette);
267 | }
268 | 
269 | void process_scanline(const struct jpeg_decompress_struct *jpg, const JSAMPLE* scanline, Image* i) {
270 | 	static int lasty = 0;
271 | 	const int y = ROUND( i->resize_y * (float) (jpg->output_scanline-1) );
272 | 
273 | 	// include all scanlines since last call
274 | 
275 | 	float *pixel, *red, *green, *blue;
276 | 
277 | 	pixel  = &i->pixel[lasty * i->width];
278 | 	red = green = blue = NULL;
279 | 
280 | 	if ( usecolors ) {
281 | 		int offset = lasty * i->width;
282 | 		red   = &i->red  [offset];
283 | 		green = &i->green[offset];
284 | 		blue  = &i->blue [offset];
285 | 	}
286 | 
287 | 	while ( lasty <= y ) {
288 | 
289 | 		const int components = jpg->out_color_components;
290 | 		const int readcolors = usecolors;
291 | 
292 | 		int x;
293 | 		for ( x=0; x < i->width; ++x ) {
294 | 			const JSAMPLE *src     = &scanline[i->lookup_resx[x]];
295 | 			const JSAMPLE *src_end = &scanline[i->lookup_resx[x+1]];
296 | 
297 | 			int adds = 0;
298 | 
299 | 			float v, r, g, b;
300 | 			v = r = g = b = 0.0f;
301 | 
302 | 			while ( src <= src_end ) {
303 | 
304 | 				if ( components != 3 )
305 | 					v += GRAY[src[0]];
306 | 				else {
307 | 					v += RED[src[0]] + GREEN[src[1]] + BLUE[src[2]];
308 | 
309 | 					if ( readcolors ) {
310 | 						r += (float) src[0]/255.0f;
311 | 						g += (float) src[1]/255.0f;
312 | 						b += (float) src[2]/255.0f;
313 | 					}
314 | 				}
315 | 
316 | 				++adds;
317 | 				src += components;
318 | 			}
319 | 
320 | 			pixel[x] += adds>1 ? v / (float) adds : v;
321 | 
322 | 			if ( readcolors ) {
323 | 				red  [x] += adds>1 ? r / (float) adds : r;
324 | 				green[x] += adds>1 ? g / (float) adds : g;
325 | 				blue [x] += adds>1 ? b / (float) adds : b;
326 | 			}
327 | 		}
328 | 
329 | 		++i->yadds[lasty++];
330 | 
331 | 		pixel += i->width;
332 | 
333 | 		if ( readcolors ) {
334 | 			red   += i->width;
335 | 			green += i->width;
336 | 			blue  += i->width;
337 | 		}
338 | 	}
339 | 
340 | 	lasty = y;
341 | }
342 | 
343 | void free_image(Image* i) {
344 | 	if ( i->pixel ) free(i->pixel);
345 | 	if ( i->red ) free(i->red);
346 | 	if ( i->green ) free(i->green);
347 | 	if ( i->blue ) free(i->blue);
348 | 	if ( i->yadds ) free(i->yadds);
349 | 	if ( i->lookup_resx ) free(i->lookup_resx);
350 | }
351 | 
352 | void malloc_image(Image* i) {
353 | 	i->pixel = i->red = i->green = i->blue = NULL;
354 | 	i->yadds = NULL;
355 | 	i->lookup_resx = NULL;
356 | 
357 | 	i->width = width;
358 | 	i->height = height;
359 | 
360 | 	i->yadds = (int*) malloc(height * sizeof(int));
361 | 	i->pixel = (float*) malloc(width*height*sizeof(float));
362 | 
363 | 	if ( usecolors ) {
364 | 		i->red   = (float*) malloc(width*height*sizeof(float));
365 | 		i->green = (float*) malloc(width*height*sizeof(float));
366 | 		i->blue  = (float*) malloc(width*height*sizeof(float));
367 | 	}
368 | 
369 | 	// we allocate one extra pixel for resx because of the src .. src_end stuff in process_scanline
370 | 	i->lookup_resx = (int*) malloc( (1 + width) * sizeof(int));
371 | 
372 | 	if ( !(i->pixel && i->yadds && i->lookup_resx) ||
373 | 	     (usecolors && !(i->red && i->green && i->blue)) )
374 | 	{
375 | 		fprintf(stderr, "Not enough memory for given output dimension\n");
376 | 		free_image(i);
377 | 		exit(1);
378 | 	}
379 | }
380 | 
381 | void init_image(Image *i, const struct jpeg_decompress_struct *jpg) {
382 | 	int dst_x;
383 | 
384 | 	i->resize_y = (float) (i->height - 1) / (float) (jpg->output_height - 1);
385 | 	i->resize_x = (float) (jpg->output_width - 1) / (float) (i->width );
386 | 
387 | 	for ( dst_x=0; dst_x <= i->width; ++dst_x ) {
388 | 		i->lookup_resx[dst_x] = ROUND( (float) dst_x * i->resize_x );
389 | 		i->lookup_resx[dst_x] *= jpg->out_color_components;
390 | 	}
391 | }
392 | 
393 | void decompress(FILE *fp, FILE *fout) {
394 | 	int row_stride;
395 | 	struct jpeg_error_mgr jerr;
396 | 	struct jpeg_decompress_struct jpg;
397 | 	JSAMPARRAY buffer;
398 | 	Image image;
399 | 
400 | 	jpg.err = jpeg_std_error(&jerr);
401 | 	jpeg_create_decompress(&jpg);
402 | 	jpeg_stdio_src(&jpg, fp);
403 | 	jpeg_read_header(&jpg, TRUE);
404 | 	jpeg_start_decompress(&jpg);
405 | 
406 | 	if ( jpg.data_precision != 8 ) {
407 | 		fprintf(stderr,
408 | 			"Image has %d bits color channels, we only support 8-bit.\n",
409 | 			jpg.data_precision);
410 | 		exit(1);
411 | 	}
412 | 
413 | 	row_stride = jpg.output_width * jpg.output_components;
414 | 
415 | 	buffer = (*jpg.mem->alloc_sarray)((j_common_ptr) &jpg, JPOOL_IMAGE, row_stride, 1);
416 | 
417 | 	aspect_ratio(jpg.output_width, jpg.output_height);
418 | 
419 | 	malloc_image(&image);
420 | 	clear(&image);
421 | 
422 | 	if ( verbose ) print_info(&jpg);
423 | 
424 | 	init_image(&image, &jpg);
425 | 
426 | 	while ( jpg.output_scanline < jpg.output_height ) {
427 | 		jpeg_read_scanlines(&jpg, buffer, 1);
428 | 		process_scanline(&jpg, buffer[0], &image);
429 | 		if ( verbose ) print_progress(&jpg);
430 | 	}
431 | 
432 | 	if ( verbose ) {
433 | 		fprintf(stderr, "\n");
434 | 		fflush(stderr);
435 | 	}
436 | 
437 | 	normalize(&image);
438 | 
439 | 	if ( clearscr ) {
440 | 		fprintf(fout, "%c[2J", 27); // ansi code for clear
441 | 		fprintf(fout, "%c[0;0H", 27); // move to upper left
442 | 	}
443 | 
444 | 	if ( html && !html_rawoutput ) print_html_start(html_fontsize, fout);
445 | 	if ( use_border ) print_border(image.width);
446 | 
447 | 	(!usecolors? print_image : print_image_colors) (&image, (int) strlen(ascii_palette) - 1, fout);
448 | 
449 | 	if ( use_border ) print_border(image.width);
450 | 	if ( html && !html_rawoutput ) print_html_end(fout);
451 | 
452 | 	free_image(&image);
453 | 
454 | 	jpeg_finish_decompress(&jpg);
455 | 	jpeg_destroy_decompress(&jpg);
456 | }
457 | 


--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
  1 | 		    GNU GENERAL PUBLIC LICENSE
  2 | 		       Version 2, June 1991
  3 | 
  4 |  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  5 |      51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  6 |  Everyone is permitted to copy and distribute verbatim copies
  7 |  of this license document, but changing it is not allowed.
  8 | 
  9 | 			    Preamble
 10 | 
 11 |   The licenses for most software are designed to take away your
 12 | freedom to share and change it.  By contrast, the GNU General Public
 13 | License is intended to guarantee your freedom to share and change free
 14 | software--to make sure the software is free for all its users.  This
 15 | General Public License applies to most of the Free Software
 16 | Foundation's software and to any other program whose authors commit to
 17 | using it.  (Some other Free Software Foundation software is covered by
 18 | the GNU Library General Public License instead.)  You can apply it to
 19 | your programs, too.
 20 | 
 21 |   When we speak of free software, we are referring to freedom, not
 22 | price.  Our General Public Licenses are designed to make sure that you
 23 | have the freedom to distribute copies of free software (and charge for
 24 | this service if you wish), that you receive source code or can get it
 25 | if you want it, that you can change the software or use pieces of it
 26 | in new free programs; and that you know you can do these things.
 27 | 
 28 |   To protect your rights, we need to make restrictions that forbid
 29 | anyone to deny you these rights or to ask you to surrender the rights.
 30 | These restrictions translate to certain responsibilities for you if you
 31 | distribute copies of the software, or if you modify it.
 32 | 
 33 |   For example, if you distribute copies of such a program, whether
 34 | gratis or for a fee, you must give the recipients all the rights that
 35 | you have.  You must make sure that they, too, receive or can get the
 36 | source code.  And you must show them these terms so they know their
 37 | rights.
 38 | 
 39 |   We protect your rights with two steps: (1) copyright the software, and
 40 | (2) offer you this license which gives you legal permission to copy,
 41 | distribute and/or modify the software.
 42 | 
 43 |   Also, for each author's protection and ours, we want to make certain
 44 | that everyone understands that there is no warranty for this free
 45 | software.  If the software is modified by someone else and passed on, we
 46 | want its recipients to know that what they have is not the original, so
 47 | that any problems introduced by others will not reflect on the original
 48 | authors' reputations.
 49 | 
 50 |   Finally, any free program is threatened constantly by software
 51 | patents.  We wish to avoid the danger that redistributors of a free
 52 | program will individually obtain patent licenses, in effect making the
 53 | program proprietary.  To prevent this, we have made it clear that any
 54 | patent must be licensed for everyone's free use or not licensed at all.
 55 | 
 56 |   The precise terms and conditions for copying, distribution and
 57 | modification follow.
 58 | 
 59 | 		    GNU GENERAL PUBLIC LICENSE
 60 |    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 61 | 
 62 |   0. This License applies to any program or other work which contains
 63 | a notice placed by the copyright holder saying it may be distributed
 64 | under the terms of this General Public License.  The "Program", below,
 65 | refers to any such program or work, and a "work based on the Program"
 66 | means either the Program or any derivative work under copyright law:
 67 | that is to say, a work containing the Program or a portion of it,
 68 | either verbatim or with modifications and/or translated into another
 69 | language.  (Hereinafter, translation is included without limitation in
 70 | the term "modification".)  Each licensee is addressed as "you".
 71 | 
 72 | Activities other than copying, distribution and modification are not
 73 | covered by this License; they are outside its scope.  The act of
 74 | running the Program is not restricted, and the output from the Program
 75 | is covered only if its contents constitute a work based on the
 76 | Program (independent of having been made by running the Program).
 77 | Whether that is true depends on what the Program does.
 78 | 
 79 |   1. You may copy and distribute verbatim copies of the Program's
 80 | source code as you receive it, in any medium, provided that you
 81 | conspicuously and appropriately publish on each copy an appropriate
 82 | copyright notice and disclaimer of warranty; keep intact all the
 83 | notices that refer to this License and to the absence of any warranty;
 84 | and give any other recipients of the Program a copy of this License
 85 | along with the Program.
 86 | 
 87 | You may charge a fee for the physical act of transferring a copy, and
 88 | you may at your option offer warranty protection in exchange for a fee.
 89 | 
 90 |   2. You may modify your copy or copies of the Program or any portion
 91 | of it, thus forming a work based on the Program, and copy and
 92 | distribute such modifications or work under the terms of Section 1
 93 | above, provided that you also meet all of these conditions:
 94 | 
 95 |     a) You must cause the modified files to carry prominent notices
 96 |     stating that you changed the files and the date of any change.
 97 | 
 98 |     b) You must cause any work that you distribute or publish, that in
 99 |     whole or in part contains or is derived from the Program or any
100 |     part thereof, to be licensed as a whole at no charge to all third
101 |     parties under the terms of this License.
102 | 
103 |     c) If the modified program normally reads commands interactively
104 |     when run, you must cause it, when started running for such
105 |     interactive use in the most ordinary way, to print or display an
106 |     announcement including an appropriate copyright notice and a
107 |     notice that there is no warranty (or else, saying that you provide
108 |     a warranty) and that users may redistribute the program under
109 |     these conditions, and telling the user how to view a copy of this
110 |     License.  (Exception: if the Program itself is interactive but
111 |     does not normally print such an announcement, your work based on
112 |     the Program is not required to print an announcement.)
113 | 
114 | These requirements apply to the modified work as a whole.  If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works.  But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 | 
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 | 
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 | 
134 |   3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 | 
138 |     a) Accompany it with the complete corresponding machine-readable
139 |     source code, which must be distributed under the terms of Sections
140 |     1 and 2 above on a medium customarily used for software interchange; or,
141 | 
142 |     b) Accompany it with a written offer, valid for at least three
143 |     years, to give any third party, for a charge no more than your
144 |     cost of physically performing source distribution, a complete
145 |     machine-readable copy of the corresponding source code, to be
146 |     distributed under the terms of Sections 1 and 2 above on a medium
147 |     customarily used for software interchange; or,
148 | 
149 |     c) Accompany it with the information you received as to the offer
150 |     to distribute corresponding source code.  (This alternative is
151 |     allowed only for noncommercial distribution and only if you
152 |     received the program in object code or executable form with such
153 |     an offer, in accord with Subsection b above.)
154 | 
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it.  For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable.  However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 | 
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 | 
172 |   4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License.  Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 | 
180 |   5. You are not required to accept this License, since you have not
181 | signed it.  However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works.  These actions are
183 | prohibited by law if you do not accept this License.  Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 | 
189 |   6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions.  You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 | 
197 |   7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License.  If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all.  For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 | 
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 | 
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices.  Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 | 
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 | 
229 |   8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded.  In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 | 
237 |   9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time.  Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 | 
242 | Each version is given a distinguishing version number.  If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation.  If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 | 
250 |   10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission.  For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this.  Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 | 
258 | 			    NO WARRANTY
259 | 
260 |   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 | 
270 |   12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 | 
280 | 		     END OF TERMS AND CONDITIONS
281 | 
282 | 	    How to Apply These Terms to Your New Programs
283 | 
284 |   If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 | 
288 |   To do so, attach the following notices to the program.  It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 | 
293 |     
294 |     Copyright (C)   
295 | 
296 |     This program is free software; you can redistribute it and/or modify
297 |     it under the terms of the GNU General Public License as published by
298 |     the Free Software Foundation; either version 2 of the License, or
299 |     (at your option) any later version.
300 | 
301 |     This program is distributed in the hope that it will be useful,
302 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
303 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
304 |     GNU General Public License for more details.
305 | 
306 |     You should have received a copy of the GNU General Public License
307 |     along with this program; if not, write to the Free Software
308 |     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
309 | 
310 | 
311 | Also add information on how to contact you by electronic and paper mail.
312 | 
313 | If the program is interactive, make it output a short notice like this
314 | when it starts in an interactive mode:
315 | 
316 |     Gnomovision version 69, Copyright (C) year  name of author
317 |     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318 |     This is free software, and you are welcome to redistribute it
319 |     under certain conditions; type `show c' for details.
320 | 
321 | The hypothetical commands `show w' and `show c' should show the appropriate
322 | parts of the General Public License.  Of course, the commands you use may
323 | be called something other than `show w' and `show c'; they could even be
324 | mouse-clicks or menu items--whatever suits your program.
325 | 
326 | You should also get your employer (if you work as a programmer) or your
327 | school, if any, to sign a "copyright disclaimer" for the program, if
328 | necessary.  Here is a sample; alter the names:
329 | 
330 |   Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331 |   `Gnomovision' (which makes passes at compilers) written by James Hacker.
332 | 
333 |   , 1 April 1989
334 |   Ty Coon, President of Vice
335 | 
336 | This General Public License does not permit incorporating your program into
337 | proprietary programs.  If your program is a subroutine library, you may
338 | consider it more useful to permit linking proprietary applications with the
339 | library.  If this is what you want to do, use the GNU Library General
340 | Public License instead of this License.
341 | 


--------------------------------------------------------------------------------