aalib-wrapper for python?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Karsten Heymann

    aalib-wrapper for python?

    Hello List,

    Maybe someone can help me with some hobby project...

    I'm currently searching for a way to convert photos to assci-art files ready
    to print out, which means to a postscript or pdf file, which contains many
    many letters in some non-proportional font which together look like the
    photo. Currently I'm using

    gimp (for looking up image size)
    gnumeric (for line length calculations)
    asciiview (load image and create ascii text from it)
    enscript (for conversion from text to ps).

    But that's cumbersome, so I'd love to put it all into an python script (as
    python is my favourite scripting language:). Replacing gimp, gnumeric and
    enscript is not a problem (thanks to pil and reportlab), but I couldn't
    find a way to access aalibs funtionality from within python. Is there such
    a wrapper or do I have to write ony myself? I'm not a C expert so I'd love
    to avoid that. And can anyone estimate how much work it would be?

    Maybe it helps if I tell you more precisely I want to do in that script:

    - load image with pil and get its size
    - for a chosen font (let's say courier 5) calculate how many characters
    fit onto a sheet of paper (let's say with size a4) horizontally and
    vertically
    - from that and the images aspect ration calculate line length and number
    of lines of the resulting ascii image
    - feed the image to aalib (I wonder how to do that) and get the ascii data
    back (tuple of strings?)
    - use reportlab to create an pdf file containing the ascii data centered to
    the middle (if line length or number of lines don't fill up the page
    completely)

    And those I want to print out on quality paper and hang them on my wall :)

    (May seem strange to you, but I like it! I've got the linux penguin on a a3
    sheet of paper on my office's door and feel happy everytime I come to
    work...)

    Maybe someone has an idea on anything of the above. Any help or ideas would
    be greatly appreciated!

    Karsten
Working...