[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcaca] Re: functional hacks to img2irc



On Fri, Oct 26, 2007, Rado S wrote:

> Looking around for alternatives, I came across img2irc, but it was
> somehow not exactly what I needed (plain text), since it was
> producing stupid mirc color codes. So I wanted to hack it to drop
> the codes right where it produces them, but then I realized it was
> just the "irc" export of several others. At first I was "yay", but
> then went "d'oh", because among the various exporters is no plain
> text one.
> 
> Can you please add one? :)
> Please compare it to aview, images should be at least as
> recognizable. (on 150x110 terminal ;)

   aview will at the moment do a much better job than img2irc. At the
beginning libcaca was only focusing on colour accuracy and did not care
about shape accuracy; AAlib on the other hand did an excellent job of
selecting the right character in the right place. Combining both is an
extremely difficult problem with no efficient solution, but we are
working on improving that.

   Here is an example of the forthcoming dither algorithm:

    http://people.zoy.org/~sam/new-dither.png
    http://people.zoy.org/~sam/new-dither-2.png

   In the first picture you can see how it cleverly uses characters such
as ' , : _ to smooth the edges. This is something libcaca had never
been able to do (yet many people were absolutely convinced it was, and
bragged about how the quality was superior to AAlib. Oh well).

   In the second picture you can see how it already compares with the
current method without even having colour support. Of course, adding
colour is going to be the complicated part.

> In the meantime I hacked img2irc to accept a parameter to specify
> which exporter to use, which would justify a rename to img2asc.
> Default is now "ansi", because it lets me easily filter out the
> ESC-codes to produce a plain text variant, but the result is still
> inferior to aview, because cacaview probably depends on the missing
> colors for best result.

   Is there no way that mutt can read colour codes of some sort to
display inline content? It's kinda sad to use a libcaca tool to end
in grayscale. AAlib really does a better job for the moment.

> Again, the attached patch for img2asc ;) is not perfect, but you get
> the idea of what to change better.
> You should probably remove the line
> 	fprintf(stderr, "%s: loading %s\n", format, argv[1]);
> because I used it only for testing.
> 
> I've also changed some defaults (80 rather than 60 cols), and the
> ratio of x/y fontsize to better match my standard font.
> This reminded me that it would be better if the font ratio could be
> specified on the cmd-line, too. IIRC aview doesn't have that yet
> either.

   Thanks again. I'm not sure we'll merge your patches immediately (at
least not until we plan a release), but be sure that we're interested in
getting img2irc somewhere. In fact it might probably have to be called
something else and become a general-purpose anything-to-text conversion
tool.

Regards,
-- 
Sam.
-- 
This is the libcaca mailing-list, see http://libcaca.zoy.org/
Trouble unsubscribing? Please contact <sam@zoy.org>
List archives are at http://libcaca.zoy.org/list/