Code Monkey home page Code Monkey logo

ansilove's Introduction

         _______         ___________          ___
       __\___   \_  ____/     /\   /______ ___\_/__            /\
      /    \|     \/  _ \    /--\_____    \\   /  /\          /  \
    _/      |     /    \     \      |/     /      \ \ _ _____/    \_______
    \       |_____\____/     /      /      \____  /\/                    /
     \______|      \  \_____/\______       /\   \/  \   /\NSILOVE / C   /____ _
      \     |_______\__\___ \ \    \      /  \___\__/____
       \____|        /____/\_\/\__ /     / __/___ \     /\    ____
                     \    \ \     /     /_/ __   \/    /__\__/  _/ _____ ___
                 /\   \____\/    /     //   \    /    /    /    _>/    //__/\
                /  \           _/      \   //   /    /    /     \/    / \__\/
_ _________    /    \_______ _ \___    /_______/    /   _/ \____      \  /
           \  /                 \ \___/\       \_______/\\  \  \______/\/
            \/                   \_\  \ \_______\      \ \\/ \__\     \ \
                                    \__\/        \______\/ h7/dS!\_____\/

AnsiLove/C

AnsiLove is an ANSI and ASCII art to PNG converter, allowing to convert ANSI and artscene-related file formats into PNG images, supporting ANSI (.ANS), PCBoard (.PCB), Binary (.BIN), Artworx (.ADF), iCE Draw (.IDF), Tundra (.TND) and XBin (.XB) formats.

It creates size optimized 4-bit PNG files and supports SAUCE (Standard Architecture for Universal Comment Extensions), 80x25 and 80x50 PC fonts (including all the 14 MS-DOS charsets), Amiga fonts, and iCE colors.

This is a complete rewrite of AnsiLove/PHP in the C programming language.

Experimental seccomp support is available for selected architectures and can be enabled by setting the ENABLE_SECCOMP variable to 1 when invoking CMake.

Specs

AnsiLove/C is strictly using the C99 standard to achieve high portability to all major operating systems. Supported compilers are GCC and Clang, others may work but aren't tested. We use Linux and OpenBSD for AnsiLove/C development.

Why C?

There were many reasons, most notably PHP interpreter independence and performance. A solid C foundation is just perfect for creating libraries and it can easily be embedded into applications. We already mentioned portability. What else? We wanted evolution. AnsiLove/C should not be understood as a port. It takes many different approaches (like processing binary font dumps or generating @2x Retina images), it is overall improved and introduces new features. While results tend to be the same, the codebase does not have much in common with it's ancestor.

Dependencies

AnsiLove/C uses the CMake build system and requires the libansilove library and header files.

Installing dependencies

  • OpenBSD: pkg_add -r cmake
  • NetBSD: pkgin install cmake
  • FreeBSD: pkg install cmake
  • macOS: brew install cmake
  • Alpine Linux: apk add cmake gcc make musl-dev
  • Debian / Ubuntu / Mint: apt-get install build-essential cmake
  • Fedora: dnf install cmake gcc make
  • Solus: eopkg install -c system.devel

Binary packages for libansilove are available on OpenBSD, NetBSD, FreeBSD, Debian, Ubuntu, and Solus.

On other systems, libansilove has to be installed manually.

Compiling

mkdir build
cd build
cmake ..
make

Packages

Ansilove packages are available for:

Features

The following formats are supported:

  • .ANS - ANSi (ANSI escape sequences: ANSI X3.64 standard)
  • .PCB - PCBoard Bulletin Board System (BBS) own file format
  • .BIN - Binary format (raw memory copy of text mode video memory)
  • .ADF - Artworx format, supporting custom character sets and palettes
  • .IDF - iCE Draw format, supporting custom character sets and palettes
  • .TND - TundraDraw format, supporting 24-bit color mode
  • .XB - The eXtended Binary XBin format, supporting custom character sets and palettes

Files with custom suffix default to the ANSi renderer (e.g. ICE or CIA).

AnsiLove/C is capable of processing:

  • SAUCE records
  • DOS and Amiga fonts (embedded binary dump)
  • iCE colors

Even more:

  • Small output file size (4-bit PNG).
  • Optionally generates proper Retina @2x (and up to @8x) PNG.
  • You can use custom options for adjusting output results.
  • Built-in support for rendering Amiga ASCII.

Documentation

Synopsis

     ansilove [-dhiqrsv] [-b bits] [-c columns] [-f font] [-m mode] [-o file]
              [-R factor] [-t type] file

Options

     -b bits     Set to 9 to render 9th column of block characters (default:
                 8).

     -c columns  Adjust number of columns for ANSI, BIN, and TND files.

     -d          Enable DOS aspect ratio.

     -f font     Select font for supported formats.

     -h          Show help.

     -i          Enable iCE colors.

     -m mode     Set rendering mode for ANS files. Valid options are:

                 ced     Black on gray, with 78 columns.

                 transparent
                         Render with transparent background.

                 workbench
                         Use Amiga Workbench palette.

     -o file     Specify output filename/path.

     -q          Suppress output messages (quiet).

     -r          Create Retina @2x output file.

     -R factor   Create Retina output file with custom scale factor.

     -t type     Specify input file type.

     -s          Show SAUCE record without generating output.

     -S          If available, use SAUCE info for render options (ex: width).

     -v          Show version information.

There are certain cases where you need to set options for proper rendering. However, this is occasionally. Results turn out well with the built-in defaults.

Fonts

We dumped many fonts as binary data right into AnsiLove/C, so the most popular typefaces for rendering ANSi / ASCII art are available at your fingertips.

PC fonts can be (all case-sensitive):

  • 80x25 Default (Code page 437)
  • 80x50 80x50 mode (Code page 437)
  • cp737 Greek (Code page 737)
  • cp775 Baltic (Code page 775)
  • cp850 Latin-1 (Code page 850)
  • cp852 Latin-2 (Code page 852)
  • cp855 Cyrillic (Code page 855)
  • cp857 Turkish (Code page 857)
  • cp860 Portuguese (Code page 860)
  • cp861 Icelandic (Code page 861)
  • cp862 Hebrew (Code page 862)
  • cp863 French Canadian (Code page 863)
  • cp865 Nordic (Code page 865)
  • cp866 Russian (Code page 866)
  • cp869 Greek (Code page 869)
  • terminus Terminus (Modern font, code page 437)

AMIGA fonts can be (all case-sensitive):

  • amiga (alias to Topaz)
  • microknight (Original MicroKnight version)
  • microknight+ (Modified MicroKnight version)
  • mosoul (Original mO'sOul font)
  • pot-noodle (Original P0T-NOoDLE font)
  • topaz (Original Topaz Kickstart 2.x version)
  • topaz+ (Modified Topaz Kickstart 2.x+ version)
  • topaz500 (Original Topaz Kickstart 1.x version)
  • topaz500+ (Modified Topaz Kickstart 1.x version)

Bits

bits can be:

  • 8 (8-bit)
  • 9 (9-bit)

Setting the bits to 9 will render the 9th column of block characters, so the output will look like it is displayed in real textmode.

See the "Memory Map" section of the Monochrome Display Adapter notes for more information.

Rendering Mode

mode can be (all case-sensitive):

  • ced
  • transparent
  • workbench

Setting the mode to ced will cause the input file to be rendered in black on gray, and limit the output to 78 columns (only available for ANS files). Used together with an Amiga font, the output will look like it is displayed on Amiga.

Setting the mode to workbench will cause the input file to be rendered using Amiga Workbench colors (only available for ANS files).

Settings the mode to transparent will produce output files with transparent background (only available for ANS files).

iCE Colors

iCE colors are disabled by default, and can be enabled by specifying the -i option.

When an ANSi source was created using iCE colors, it was done with a special mode where the blinking was disabled, and you had 16 background colors available. Basically, you had the same choice for background colors as for foreground colors, that's iCE colors.

Columns

columns is only relevant for .ANS, .BIN, .PCB, and .TND files, and is optional. In most cases conversion will work fine if you don't set this flag, the default value is 160 for .BIN files and 80 otherwise.

SAUCE records

It's fine to use AnsiLove/C as SAUCE reader without generating any output, just set option -s for this purpose.

Projects using Ansilove

  • 16colo.rs - ANSI/ASCII art archive
  • Durdraw - ASCII, Unicode and ANSI art editor for UNIX-like systems
  • emacs-ansilove - Display buffers as PNG images using ansilove inside GNU Emacs

License

AnsiLove/C is released under the BSD 2-Clause license. See the LICENSE file for details.

Authors

AnsiLove/C is developed by Stefan Vogt (@ByteProject), Brian Cassidy (@bricas) and Frederic Cambus (@fcambus).

Resources

Project homepage: https://www.ansilove.org

GitHub: https://github.com/ansilove/ansilove

ansilove's People

Contributors

amdmi3 avatar bart-d avatar bricas avatar byteproject avatar fcambus avatar h3rb avatar joshstrobl avatar nail7 avatar timb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansilove's Issues

FIX: ansilove: error while loading shared libraries: libansilove.so.1

I have had this problem with Fedora Linux, and it is the same error message as #23, but from a different cause.

After building and installing libansilove.

$ ls -l /usr/local/lib64/ 

lrwxrwxrwx. 1 root root     16 Dec 12 17:47 libansilove.so -> libansilove.so.1
lrwxrwxrwx. 1 root root     20 Dec 12 17:47 libansilove.so.1 -> libansilove.so.1.4.1
-rwxr-xr-x. 1 root root 143960 Dec 12 17:46 libansilove.so.1.4.1
-rw-r--r--. 1 root root 156664 Dec 12 17:46 libansilove-static.a
$ ansilove -v
ansilove: error while loading shared libraries: libansilove.so.1: cannot open shared object file: No such file or directory

A fix thanks to fedoeraform.

cd /etc/ld.so.conf.d
sudo touch libansilove-x86_64.conf
sudo chmod a+w libansilove-x86_64.conf
echo '/usr/local/lib64/' > libansilove-x86_64.conf
sudo chmod a-w,u+w libansilove-x86_64.conf
$ ansilove -v
AnsiLove/C 4.2.0 - ANSI / ASCII art to PNG converter

Output SAUCE Metadata as PNG tEXt Chunks

A bit of a thought experiment in discussing the output of ansi to PNG with the maintainer of 16c, James Bodie.

I had the thought to create a function that would take SAUCE metadata and write it (optionally perhaps) to the PNG as tEXt chunks such that when viewing the PNG with something like macOS Preview -> Tools -> Show Inspector it would show the SAUCE data converted to PNG metadata.

I was able to edit the PNG in Adobe Lightroom and test it manually to see what would show yielding:
screen shot 2017-12-19 at 3 24 46 pm

The issue I see is that I can't seem to find any documentation in libgd for writing tEXt chunks in a PNG. I see how to do it in libpng but not in gd. @fcambus any thoughts?

Output animated png with blink attribute

Hi,

I love ansilove, it is great. Just want to check:

Can I convert .ANS to png with blink effect?

I tried different options, but it did work. I give an example blow.

Raw .ANS file blink_test.ans.gz

Convert to animated png by Moebius
blink_test

Convert to png by ansilove

ansilove -o blink_test_regular.png blink_test.ans

blink_test_regular

with -i option by ansilove

ansilove -i -o blink_test_iCE.png blink_test.ans

blink_test_iCE

Missing files?

There seems to be a large amount of code missing. Looking at version 4.0.0 (master) the src directory has just 15.8k worth of code in it, where as version 3.0.9 has 647k. Missing the whole src/loaders/ directory, ansilove.h, explode.*, fonts.c, main.c, output.* and maybe some others.

Also, compiling version 3.0.9 works just fine, but with 4.0.0, CMake complains about missing variables called ANSILOVE_INCLUDE_DIRS and ANSILOVE_LIBRARIES and stops.

[Feature] Add option to use SAUCE info for rendering hints

The primary use case for pulling the SAUCE info would be for odd-width ansi rendering. As it stands, a user must specify the width manually. Allowing the info to be pulled automatically would simplfy the rendering process in a number of cases.

Note: there are chances of false positives, but the information currently seen in the "wild" would help far more than it would hurt.

This may require a little discussion, but i'm sure width is the most useful bit of information available. There are other bits available -- font name[(v00.5 SAUCE only), for example, could be handy, but perhaps this should be focused on width for now.

Messages are written to stdout instead of stderr

After #11 was fixed, I've expected ansilove to work with -o /dev/stdout, however while it does seem to correctly write png there, it also writes messages there, resulting in corrupted file. Would be nice to write messages to stderr so ansilove could be used in pipelines. It'd also be nice to support -o - as an alias for writing to stdout like many other apps do.

"File (null) not found." error

after compiling on 32-bit linux (ubuntu), i get this output when trying to generate pngs:

~/src/AnsiLove-C$ ./ansilove ansis/rad-love.ans -i
AnsiLove/C 2.2.1 - ANSi / ASCII art to PNG converter
Copyright (C) 2011-2015 Stefan Vogt, Brian Cassidy, Frederic Cambus.
./ansilove: option requires an argument -- 'i'

File (null) not found.

and

~/src/AnsiLove-C$ ./ansilove ansis/rad-love.ans -o out
AnsiLove/C 2.2.1 - ANSi / ASCII art to PNG converter
Copyright (C) 2011-2015 Stefan Vogt, Brian Cassidy, Frederic Cambus.

File (null) not found.

if it is any help, CMakeFiles/CMakeOutput.log is at http://pastebin.com/raw.php?i=d3aKT7aD

Case conversion before opening file

Hi,

Thank you for writing ansilove. Awesome work!

I had to patch ansilove to convert an all uppercase file, because in main.c:282 the extension part of the filename is converted to lower case before the file is being opened.

You could do case-insensitive string comparison instead, to avoid the malloc/copy/free. I don't know what I prefer myself, but this was my quick fix.

282c282,284
<         char *fext = strrchr(input, '.');

---
>         char *fext_ptr = strrchr(input, '.');
>         char *fext = malloc(strlen(fext_ptr)+1);
>         strcpy(fext, fext_ptr);
310a313,314
> 
>         free(fext);

Cheers!
gaffa

osx fails to build on master

✔ 04:36 sneak@nostromo ~/dev/ansilove/build $ cmake ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pledge
-- Looking for pledge - not found
-- Looking for strtonum
-- Looking for strtonum - not found
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ANSILOVE_INCLUDE_DIRS
   used as include directory in directory /Users/sneak/dev/ansilove
   used as include directory in directory /Users/sneak/dev/ansilove
   used as include directory in directory /Users/sneak/dev/ansilove
   used as include directory in directory /Users/sneak/dev/ansilove
   used as include directory in directory /Users/sneak/dev/ansilove
   used as include directory in directory /Users/sneak/dev/ansilove
   used as include directory in directory /Users/sneak/dev/ansilove
   used as include directory in directory /Users/sneak/dev/ansilove
ANSILOVE_LIBRARIES
    linked by target "ansilove" in directory /Users/sneak/dev/ansilove

-- Configuring incomplete, errors occurred!
See also "/Users/sneak/dev/ansilove/build/CMakeFiles/CMakeOutput.log".
See also "/Users/sneak/dev/ansilove/build/CMakeFiles/CMakeError.log".
 [ master | ✔  ]
✔ 04:36 sneak@nostromo ~/dev/ansilove/build $

Allow @3x Scale Factor Output

I am currently working on an ansilove viewer for iOS. With the advent of iPhone X and the Plus series, their "retina" display is not the typical 2x scale factor that the bool createRetinaRep allows, they use a 3x scale factor.

Does it make sense to deprecate the createRetinaRep flag in favor of a int scaleFactor or maintain backward compatibility with createRetinaRep by keeping it with a default 2x scale factor but the ability to pass in an additional int scaleFactor that could be set to 3?

Reference: https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/image-size-and-resolution/

Segfault when unable to open output file

This and possibly other places lack check for file_Out == NULL when it's not possible to open output file. Because of that ansilove would segfault if it fails to open output file.

[Q] Can this be used to render terminal output to PNG?

I tried converting

[48;2;0;0;255m [38;2;0;255;0mHELLO  [38;2;255;100;0mBRAVE [38;2;0;255;0m  [48;2;100;0;255mNEW [48;2;0;0;255m WORLD!
 [00m

to png, but it says:

Input File: a.ans
Output File: a.png
Font: 80x25
Bits: 8
Columns: 80

File a.ans does not have a SAUCE record.

Some characters not rendering properly

Hi!

Thank you for this great tool. I have the issue that some characters don't render properly in ansilove while it works fine in Ascension. I tried every supported font but it doesn't seem to matter.

As an example, this input file results in this image. However, in the terminal, my text editor and Ascension the borders of the boxes are rendered properly like this.

In case you're wondering what I'm doing, I'm trying to render terminal output to images by doing something like this:
tmux capture-pane -p -e > out.txt && ansilove -o out.png out.txt

I have to admit, I'm not a font/ansi/charset expert so this might be a dumb question. Any feedback would still be appreciated.

Thank you for your time.

Amiga renderer occasionally produces underlines

Here is a bug that is quite hard to explain. Sometimes, the Amiga renderer fails to render properly. Occurs when rendering a file with flag "amiga" and one of the Amiga fonts. AnsiLove/C generates underlines where there are not intended to go. Even more weird is the fact that sometimes it works, and sometimes it just doesn't. For instance, you can render a file and it looks fine. Repeat the rendering process a few times and you might encounter the issue. A photo of how the bug looks like is available here http://cl.ly/image/3J0X0T2w2x0o and a great example file for testing is available here http://cl.ly/183O0837303U

Rendering with transparent mode and >=2 scaling factor breaks transparent background

ansilove: 4.0.3
libansilove 1.1.4

Rendering with a regular 1x scaling factor works as intended but when using -r or -R 2-8 it seems to use the first ANSI color as the background.

Attached results of:
ansilove -r -m transparent tk-droid.ans -o tk-droid-r2-transparent.png
ansilove -m transparent tk-droid.ans -o tk-droid-transparent.png

tk-droid-transparent
tk-droid-r2-transparent

Suppress output?

Could a switch/option be added to suppress all output when performing conversions?

use of undeclared identifier for ANSILOVE_FONT_*

I'm trying to re-install ansilove after switching to a different Mac running High Sierra.

I couldn't get the default installation instructions for to work libansilove or ansilove, but I had success by changing the cmake command slightly:

cmake -S .. -B .

After this, make worked perfectly for libansilove. However, I am running into a problem compiling ansilove. Here is the error output:

[ 16%] Building C object CMakeFiles/ansilove.dir/src/ansilove.c.o
In file included from /Users/dummy/repos/ansilove/src/ansilove.c:32:
/Users/dummy/repos/ansilove/src/fonts.h:60:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP737'
        ANSILOVE_FONT_CP737,                    /* Greek */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:61:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP775'
        ANSILOVE_FONT_CP775,                    /* Baltic */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:62:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP850'
        ANSILOVE_FONT_CP850,                    /* Latin 1 */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:63:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP852'
        ANSILOVE_FONT_CP852,                    /* Latin 2 */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:64:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP855'
        ANSILOVE_FONT_CP855,                    /* Cyrillic */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:65:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP857'
        ANSILOVE_FONT_CP857,                    /* Turkish */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:66:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP860'
        ANSILOVE_FONT_CP860,                    /* Portuguese */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:67:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP861'
        ANSILOVE_FONT_CP861,                    /* Icelandic */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:68:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP862'
        ANSILOVE_FONT_CP862,                    /* Hebrew */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:69:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP863'
        ANSILOVE_FONT_CP863,                    /* French-canadian */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:70:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP865'
        ANSILOVE_FONT_CP865,                    /* Nordic */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:71:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP866'
        ANSILOVE_FONT_CP866,                    /* Russian */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:72:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP869'
        ANSILOVE_FONT_CP869,                    /* Greek */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:73:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP437'
        ANSILOVE_FONT_CP437,                    /* IBM PC 80x25 */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:74:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP437_80x50'
        ANSILOVE_FONT_CP437_80x50,              /* IBM PC 80x50 */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:75:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP737'
        ANSILOVE_FONT_CP737,                    /* Greek */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:76:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP775'
        ANSILOVE_FONT_CP775,                    /* Baltic */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:77:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP850'
        ANSILOVE_FONT_CP850,                    /* Latin 1 */
        ^
/Users/dummy/repos/ansilove/src/fonts.h:78:2: error: use of undeclared identifier 'ANSILOVE_FONT_CP852'
        ANSILOVE_FONT_CP852,                    /* Latin 2 */
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/ansilove.dir/src/ansilove.c.o] Error 1
make[1]: *** [CMakeFiles/ansilove.dir/all] Error 2
make: *** [all] Error 2

Wide ANSis are being line-wrapped

Thanks for the excellent ansi tool!

I just wanted to mention that I've found a small issue with extra-wide ANSIs, which specify their width/height in the SAUCE TInfo1/2 fields. ansilove looks like it's ignoring these fields and treating it as 80-column ANSI.

(The SAUCE specification for FileType 1's TInfo fields can be found here: http://www.acid.org/info/sauce/sauce.htm#FileType)

Here's an example of an extra-wide ANSI:
https://pc.textmod.es/pack/download/blocktronics-6710/misfit-astromech.ans

The latest release (3.0.9) renders it like this:

While the master branch renders it like this:

(Aside: do you think it would be a good idea to allow the -c option to work on ANSIs as well as BINs? You know, in case there are some wide ANSIs without proper SAUCE records.)

XBin 512 char font problem

I made a real masterpiece using the .xb format and wanted to convert it to a nice png - unfortunately ansilove doesn't read it correctly :(

test.zip

Seems that extended fonts are not correctly implemented in ansilove - or maybe my implementation is wrong.
(I'm currently working on updating my ansi drawing tool)

However I tested it with an old DOS tool (SIMPLEXB.EXE from acdu0896) and it seems to work.
FYI DOSBox doesn't render the colors correctly because they treat bit 3 as font selection AND high intensity bit. In case you want to try. Maybe that can be solved using a custom palette setting the intense colors to low values but that's not the real goal :).

Old VGA hardware only took bit 3 as font selector and reduced the choice of foreground colors to 0-7 - yeah funny limits.

It's not a real bug. I couldn't find any .xb file supporting extended character sets - I would be interested in getting any for testing purposes.

-o option works in an unexpected way

In most utils, -o <filename> makes output written to <filename>, though ansilove instead writes to <filename>.png. IMO that's POLA violation which does not allow to specify exact output filename and should be fixed.

Error on raspberry pi

dev@raspberrypi:~$ git clone https://github.com/ansilove/ansilove.git
Cloning into 'ansilove'...
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 3448 (delta 1), reused 4 (delta 1), pack-reused 3443
Receiving objects: 100% (3448/3448), 2.16 MiB | 2.03 MiB/s, done.
Resolving deltas: 100% (2374/2374), done.
dev@raspberrypi:~$ cd ansilove
dev@raspberrypi:~/ansilove$ mkdir build
dev@raspberrypi:~/ansilove$ cd build
dev@raspberrypi:~/ansilove/build$ cmake ..
-- The C compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pledge
-- Looking for pledge - not found
-- Looking for strtonum
-- Looking for strtonum - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dev/ansilove/build
dev@raspberrypi:~/ansilove/build$ make
Scanning dependencies of target ansilove
[ 16%] Building C object CMakeFiles/ansilove.dir/src/ansilove.c.o
[ 33%] Building C object CMakeFiles/ansilove.dir/src/strtolower.c.o
[ 50%] Building C object CMakeFiles/ansilove.dir/src/sauce.c.o
[ 66%] Building C object CMakeFiles/ansilove.dir/compat/pledge.c.o
[ 83%] Building C object CMakeFiles/ansilove.dir/compat/strtonum.c.o
[100%] Linking C executable ansilove
[100%] Built target ansilove
dev@raspberrypi:~/ansilove/build$ make install
[100%] Built target ansilove
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/ansilove
-- Set runtime path of "/usr/local/bin/ansilove" to ""
-- Installing: /usr/local/share/man/man1/ansilove.1
ansilove: error while loading shared libraries: libansilove.so.1: cannot open shared object file: No such file or directory

What's wrong

Won't build on the Mac

Trying to run cmake . on the Mac results in the following error output:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ANSILOVE_INCLUDE_DIRS
   used as include directory in directory /Users/kirkman/Sites/ansilove
   used as include directory in directory /Users/kirkman/Sites/ansilove
   used as include directory in directory /Users/kirkman/Sites/ansilove
   used as include directory in directory /Users/kirkman/Sites/ansilove
   used as include directory in directory /Users/kirkman/Sites/ansilove
   used as include directory in directory /Users/kirkman/Sites/ansilove
   used as include directory in directory /Users/kirkman/Sites/ansilove
ANSILOVE_LIBRARIES
    linked by target "ansilove" in directory /Users/kirkman/Sites/ansilove

-- Configuring incomplete, errors occurred!
See also "/Users/kirkman/Sites/ansilove/CMakeFiles/CMakeOutput.log".
See also "/Users/kirkman/Sites/ansilove/CMakeFiles/CMakeError.log".

I'm attaching the two .log files for your reference.

CMakeError.log
CMakeOutput.log

Compilation issues on Debian 8.2 (jessie)

Just cloned from the master branch.

$ cmake .
-- The C compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for strtonum
-- Looking for strtonum - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cyrus/tmp/ansilove
$ make
Scanning dependencies of target ansilove
[ 12%] Building C object CMakeFiles/ansilove.dir/src/main.c.o
[ 25%] Building C object CMakeFiles/ansilove.dir/src/albinfonts.c.o
[ 37%] Building C object CMakeFiles/ansilove.dir/src/ansilove.c.o
/home/cyrus/tmp/ansilove/src/ansilove.c: In function ‘alAnsiLoader’:
/home/cyrus/tmp/ansilove/src/ansilove.c:665:40: error: variable ‘cedForegroundColor’ set but not used [-Werror=unused-but-set-variable]
         int32_t cedBackgroundColor[3], cedForegroundColor[3];
                                        ^
/home/cyrus/tmp/ansilove/src/ansilove.c:288:13: error: variable ‘seqContent’ set but not used [-Werror=unused-but-set-variable]
     int32_t seqContent, seqValue, seqArrayCount, seq_line, seq_column;
             ^
/home/cyrus/tmp/ansilove/src/ansilove.c: In function ‘alArtworxLoader’:
/home/cyrus/tmp/ansilove/src/ansilove.c:1437:13: error: variable ‘colors’ set but not used [-Werror=unused-but-set-variable]
     int32_t colors[16];
             ^
/home/cyrus/tmp/ansilove/src/ansilove.c: In function ‘alXbinLoader’:
/home/cyrus/tmp/ansilove/src/ansilove.c:1976:5: error: implicit declaration of function ‘strndup’ [-Werror=implicit-function-declaration]
     if (strcmp(strndup((char *)input_file_buffer, 5), "XBIN\x1a") != 0) {
     ^
/home/cyrus/tmp/ansilove/src/ansilove.c:1976:16: error: passing argument 1 of ‘strcmp’ makes pointer from integer without a cast [-Werror]
     if (strcmp(strndup((char *)input_file_buffer, 5), "XBIN\x1a") != 0) {
                ^
In file included from /home/cyrus/tmp/ansilove/src/albinfonts.h:14:0,
                 from /home/cyrus/tmp/ansilove/src/ansilove.h:19,
                 from /home/cyrus/tmp/ansilove/src/ansilove.c:12:
/usr/include/string.h:144:12: note: expected ‘const char *’ but argument is of type ‘int’
 extern int strcmp (const char *__s1, const char *__s2)
            ^
/home/cyrus/tmp/ansilove/src/ansilove.c: In function ‘str_replace’:
/home/cyrus/tmp/ansilove/src/ansilove.c:2181:5: error: implicit declaration of function ‘strdup’ [-Werror=implicit-function-declaration]
     if (substr == NULL || replacement == NULL) return strdup(string);
     ^
/home/cyrus/tmp/ansilove/src/ansilove.c:2181:48: error: return makes pointer from integer without a cast [-Werror]
     if (substr == NULL || replacement == NULL) return strdup(string);
                                                ^
/home/cyrus/tmp/ansilove/src/ansilove.c:2182:12: error: assignment makes pointer from integer without a cast [-Werror]
     newstr = strdup(string);
            ^
/home/cyrus/tmp/ansilove/src/ansilove.c: In function ‘readComments’:
/home/cyrus/tmp/ansilove/src/ansilove.c:2308:34: error: assignment makes pointer from integer without a cast [-Werror]
                 comment_lines[i] = strdup(buf);
                                  ^
cc1: all warnings being treated as errors
CMakeFiles/ansilove.dir/build.make:100: set di istruzioni per l'obiettivo "CMakeFiles/ansilove.dir/src/ansilove.c.o" non riuscito
make[2]: *** [CMakeFiles/ansilove.dir/src/ansilove.c.o] Errore 1
CMakeFiles/Makefile2:60: set di istruzioni per l'obiettivo "CMakeFiles/ansilove.dir/all" non riuscito
make[1]: *** [CMakeFiles/ansilove.dir/all] Errore 2
Makefile:117: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2

I've installed the dependencies with:

sudo apt-get install cmake libgd-dev

Also, if you need it:

$ uname -a
Linux andrea 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u1 (2015-12-14) x86_64 GNU/Linux

Print log on stderr, i.e. different stream from stdout

The name stderr is a historical misnomer, it was meant to be used as if it were stdlog.

$ ansilove -s somefile.ans

...
...
...

Processed in 0.000048 seconds.

ansilove is currently printing Processed in 0.000048 seconds. on standard output stream instead if stderr. That makes it difficult to filter expected output from log. All unix utilities I know of print log on stderr to make life of users easier for filtering among other things... Thanks!

$ ansilove -v
AnsiLove/C 4.1.6 - ANSI / ASCII art to PNG converter
Copyright (c) 2011-2022 Stefan Vogt, Brian Cassidy, and Frederic Cambus.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.