Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet thread from alt.ascii-art, started 17 Apr 2001.
 _   _                     _        _             _     _           
| | | |___  ___ _ __   ___| |_     / \   _ __ ___| |__ (_)_   _____ 
| | | / __|/ _ \ '_ \ / _ \ __|   / _ \ | '__/ __| '_ \| \ \ / / _ \
| |_| \__ \  __/ | | |  __/ |_   / ___ \| | | (__| | | | |\ V /  __/
 \___/|___/\___|_| |_|\___|\__| /_/   \_\_|  \___|_| |_|_| \_/ \___|
Gwyneth Paltrow - Jave image->ascii conversion .. and discus

Gwyneth Paltrow - Jave image->ascii conversion .. and discussion of algorithms

alt.ascii-art · 10 messages · 17 Apr 2001 - 24 Apr 2001
I was just trying out Jave's imageconversion on one of the images I submitted to the
contest.
Here is Gwyneth Paltrow with a very simple set of characters making the shades.
Very stylish.


                      ...::::::::::.:::.
                    .:::::::.. :::.....::..
                 ....::oo:.... ::::...........
             ....:::::::::......oo: ........:::.
            ...:.:::ooo:...:oooo:.....    .::::::
           ..:...::::::....:oooOOo:.         .......
          ...:::::::::.. .:oo:oOOo..     .....:::::.
         ...::::oooo:......::.oOoo::::::.....:::::::
      ......:::::::o::::ooo:.:oooooooooo:::..::ooooo:..
        .:::ooOOOOoooo::...   ..    ..........:::::ooo:..
        :..:oooOOo:::...                     ..::oOOOO:.
        . .::oooo:......                        .:ooOOo.
        . .::oOoo:.......                       .::::oo.
        ...:oooo:::......                       .:: .::.
         .:ooOOo::::.....                       .:...::.
         ..:oOo::::.......                      ...  ...
          :.:oo:::::.....:oo:..      ..:::..  ....   .
          oooo:::::oO8888OOOOo:..   .:oO888O8O:...   .
          .oOo:...:oOOooo. .:::..    ...:::.o:.
           .oo:......:::.... ...         ...
            .o:.....         ....
              ......         ....
               .::...       .::..
                .:::...    .::...             .
                .:::::......:OOOO::::        ..
                .::ooo:::....:::::.      .....
                ..:ooo::oo:.....   ..........
                O8:oooo:.:oO88OOOooo::.   ...
               o8888Oooo::::oOOoooo::.
              :88888888Oo::::::::..      :.
            .:88888888888O::..         :O8
          .:O88888888888888Oo:.......oO888Oo.
        .oO888888888888888888888888888888888888Oo:.
     .oO88888888888888888888888888888888888888888888Ooo:.
  .o8888888888888888888888888888888888888888888888888888888OO
o888888888888888888888888888888888888888888888888888888888888
8888888888888888888888888888888888888888888888888888888888888
8888888888888888888888888888888888888888888888888888888888888


Markus how about being able to define your characterset yourself ?
And how does it choose the right char for a particular area ?

I can see a few different paths to achive a good conversion

1 : simply doing a assesment of the chars and assigning them a shade of grey
on which it bases it's decision on what char to render in that area

2 : Rendering the chars to tiny images and choosing the char
based on fuzzy logic comparisson betwen the rendered image of the char
and the area in which the char should be.

3: Do something in between where each char is asssigned a shade of grey AND
 some info on what areas of the "cell" it fills.

F.x a "L" could be defined as a shade 40 (0-255 with 255 as complete black)
and fill 3 corners of the cell.

 _______
|   |   |
| # |   |
| # |   |
|-#-+---|
| # |   |
| ##|## |
|___|___|

Here the L fills the top-left, bottom-left and the bottom-right corner.

Or perhaps even more detailed .
The L fills 20% top-left , 20% bottom-left and 12% bottom-right


Any more ideas on useful methods .. either thought up ones or actual methods in use by
some program.

I know most programs just assign a shade of grey to a char and put one pixel = one
char..
Which as you know don't work .. because a char is much bigger than a pixel and it's not
equally tall as it is wide.

Kind Regards
CeeJay

Hello CeeJay,

Christian 'CeeJay' Jensen wrote:
> I was just trying out Jave's imageconversion on one of the images I submitted to the
> contest.

> Markus how about being able to define your characterset yourself ?

You can do that - At least in the one algorithm where it makes sense.
There are two of them, that work differently. In the "1 pixel per
character"-Algorithm you can not only chose from four given "gradients"
but even enter your own (it is an editable textfield).

> And how does it choose the right char for a particular area ?

That depends on the algorithm - they both work differently.

> I can see a few different paths to achive a good conversion
> 
> 1 : simply doing a assesment of the chars and assigning them a shade of grey
> on which it bases it's decision on what char to render in that area

That's what my "1 pixel per character"-algorithm does.

> 2 : Rendering the chars to tiny images and choosing the char
> based on fuzzy logic comparisson betwen the rendered image of the char
> and the area in which the char should be.

I don't think that there are algorithms that do conversion in that way.
It is quite complicated to do it so and you have to remember that there
are only 126-32=94 characters in Ascii that can be used. So when you go
to much into detail it is not very likely that you will find a character
that fits good. You will only have the choice between some characters
that all do not fit very well.

In my "4 pixels per character"-algorithm I do something similar, but by
far not as complicated as you described above. Your little drawing is
exactly what I need here:
>  _______
> |   |   |
> | # |   |
> | # |   |
> |-#-+---|
> | # |   |
> | ##|## |
> |___|___|
I devide up all Ascii characters into 4 rectangular regions and write
down the "brightness" for each of them to a table. This table is the
most important part for the algorithm - It is quite hard to create a
good one and I will not make it public :o)

Now for conversion you just take four pixels of the source image and try
to find the character that fits best. The algorithm finds out what entry
in the table is best. You have to decide how to define "best" here (a
function that tells you how good an approximation is).
Even with only four regions it shows that it is very likely that none of
the ascii characters really does fit well.

Now if you go further and divide characters into more than 4 regions
(e.g.3x2) it all becomes even worse and the results when I tried to do
that were not worth considering.

Look at that: If you want to have 4 shades of gray for each region,
there are 4*4*4*4=256 possible patterns for 4 regions. But you only have
94 characters available - even less if you sort out characters like *
(it does not seem to be a good character for ascii images). And some
characters are somewhat equal in brightness/area... My algorithm does
not use as few as 4 shades of gray for each region - but this is a good
way to see why there is so few possibility to improve it.

So a division into 4 regions is the maximum of what I think makes sense.

Now we have 2 algorithms and you might say "the 4 pixels per
character"-algorithm is better. But that depends:
If you want a very small result image the 4-a is the best decision, for
it will keep some shape information:

.        ,-.
E.     ,'
 Vb._,/
  �ELP

(Only an example, done by hand)

Information of shape seems to be very important to the eye - more
important than brightness sometimes.

On the other hand, if the image itself does not have much information
about shape and has few contrast it is sometimes better not to insist on
the shape but to try to keep the brightness as good as possible. Then it
is better to chose the 1pixel-algorithm. This also is true if you want
to make a very big ascii image with a width of hundreds of characters.
The eye will then not see the shape of the characters any longer, it
will soften/blur the characters and will only see their brightness.

> 3: Do something in between where each char is asssigned a shade of grey AND
>  some info on what areas of the "cell" it fills.

As you can see my 4pixel-algo is somewhat like that. Color information,
divided to areas.

I can think of one more way to improve the results: One can stress
important lines by using characters like for drawing lines:
           _..-'
     __.-''     
_.--'           
Up to now I have not seen any algorithm that does that and I am very
interested in the results of the competition for we might be able to see
results that make use of this or other tricks.

> I know most programs just assign a shade of grey to a char and put one pixel = one
> char..
> Which as you know don't work .. because a char is much bigger than a pixel and it's not
> equally tall as it is wide.

Well, it works sometimes.

Any other ideas or opinions?

Markus

Markus Gebhard <ukg...@rz.uni-karlsruhe.de> wrote:
: On the other hand, if the image itself does not have much information
: about shape and has few contrast it is...

... an area filled with constant colour? or simple gradient?
a cloud-like pattern? anyway something of little interest :-)

brojek. 

For shapes an details have a look at this image of a rose:

1-Pixel-Algorithm:
                                                                          
.j=  
                                                                          
J    
                                                                        
=Jj    
                                                                    
.JJJ.      
                                                              
!.JJ=            
                                                             
=J=               
                                                           
'6                  
                                                          
J                    
                                                       
>J.                     
                                                     
'+>                       
                                                   
'J                          
              .>                                
>JJ                            
                 'jj       '         '++JJJ>.   
J                              
                  .555 =j''   j66jj=.          
+                               
              YYcc6YYYYYY5JJ       J555JJJJ5  
''                               
            ccccYXYYYYYYY66S>  .X665565XX665JJ  
J=JJJJJYJ=                     
      c:: YYYYYYYYYY66XYYY666>!XXSX6565XXX6656 
.56556555555J                   
        cDXYcYXX666XXXXXDD.  
.D5DXDXDXXXDXX.=J55655555JJJJJJJJ                 
       cXXDKKYXX6XXDXDXYXY         JDMDDX!
!55J5555J6JJY5YYYJYYJ!               
       YXXXDDXX6XXXXY6c:K                
YJJYJJY5JJ56                          
       :X6XDDDDXXD:    J                
!J5JJJYJ5YYJ5.                         
         X6XXXX6X                      
.J55YYYJJY5YJ5                          
            cX:                         
!X55X5YY565.                           
                                          
.J6555J.                             
                                             
=                                 

4-Pixel-Algorithm:
                                                                          
(Ar  
                                                                         
_Qr   
                                                                       
.a#%    
                                                                   
.__?!^      
                                                              
__a!""^          
                                                            
.(P^               
                                                           
_r%                 
                                                         
_P"                   
                                                       
u!^                     
                                                     
_/^                       
                                                   
.y"                         
              ^.,                            
.___a!'                           
                `5i_,      :```     
.__&wQV!''`(P`                             
                 .dAQ&,__``  _ayc!""""^        
/                               
             .&ZlmmHHBHmmmc""`   .aaagA##mQa,  _`  
._,                         
           _(Zxxgmm#Gmmmmmm&a,
_gBmmmmmmmmmmm&;t(gGGGDGGDk_,                    
      
.._gmmmQQmBmmmmmmmBGmBL_mmmmmmmmmmmBBmP`&aHmmmQmmmmmmL,                  
        gmmmmmBBBmmmmmmmmm  
`^5mmmmmmBmmBmF"_QmmmmHmmQm###GXGi,                
       _BBBBmmBmmmmmBBBmmF      
/"""TTF""\ag##HmmmmmBG##mmmQQQG_               
       3mmmBBBmmmmmBBP"5F                .d#AmAGmmA#mm) 
`^'''^`                
       ^mBBmBBBmBF"^`  /                
JAm#mA#Qmm##H)                         
        79mmmmmBF                      
(Gmm#mm#mmmmAP`                         
          `""""\       `               
^"HmmHmQmmm!"                           
                                          
^7#mHP'                              
                                              7"                     
It is like fucussing a camera lense.

Markus

Markus Gebhard <ukg...@rz.uni-karlsruhe.de> wrote:
: For shapes an details have a look at this image of a rose:

: 1-Pixel-Algorithm:
:                                                                           
[cut]

: 4-Pixel-Algorithm:
:                                                                           
[cut]

: It is like fucussing a camera lense.

Only the lenses are broken.

brojek.

> Only the lenses are broken.

...Oh, sorry for that. Here are the correct ones:

1 Pixel algorithm:
                                                                     .j
                                                                     J 
                                                                   =Jj 
                                                               .JJJ.   
                                                         !.JJ=         
                                                        =J=            
                                                      '6               
                                                     J                 
                                                  >J.                  
                                                '+>                    
                                              'J                       
        .>                                 >JJ                         
           'jj       '         '++JJJ>.    J                           
            .555 =j''   j66jj=.           +                            
        YYcc6YYYYYY5JJ       J555JJJJ5   ''                            
      ccccYXYYYYYYY66S>  .X665565XX665JJ   J=JJJJJYJ=                  
c:: YYYYYYYYYY66XYYY666>!XXSX6565XXX6656  .56556555555J                
  cDXYcYXX666XXXXXDD.   .D5DXDXDXXXDXX.=J55655555JJJJJJJJ              
 cXXDKKYXX6XXDXDXYXY         JDMDDX! !55J5555J6JJY5YYYJYYJ!            
 YXXXDDXX6XXXXY6c:K                 YJJYJJY5JJ56                       
 :X6XDDDDXXD:    J                 !J5JJJYJ5YYJ5.                      
   X6XXXX6X                       .J55YYYJJY5YJ5                       
      cX:                          !X55X5YY565.                        
                                     .J6555J.                          
                                        =                              
4 Pixel algorithm:
                                                                    (Ar
                                                                   _Qr 
                                                                 .a#%  
                                                             .__?!^    
                                                        __a!""^        
                                                      .(P^             
                                                     _r%               
                                                   _P"                 
                                                 u!^                   
                                               _/^                     
                                             .y"                       
       ^.,                             .___a!'                         
         `5i_,      :```      .__&wQV!''`(P`                           
          .dAQ&,__``  _ayc!""""^         /                             
      .&ZlmmHHBHmmmc""`   .aaagA##mQa,  _`   ._,                       
    _(Zxxgmm#Gmmmmmm&a, _gBmmmmmmmmmmm&;t(gGGGDGGDk_,                  
.._gmmmQQmBmmmmmmmBGmBL_mmmmmmmmmmmBBmP`&aHmmmQmmmmmmL,                
 gmmmmmBBBmmmmmmmmm   `^5mmmmmmBmmBmF"_QmmmmHmmQm###GXGi,              
_BBBBmmBmmmmmBBBmmF       /"""TTF""\ag##HmmmmmBG##mmmQQQG_             
3mmmBBBmmmmmBBP"5F                .d#AmAGmmA#mm)  `^'''^`              
^mBBmBBBmBF"^`  /                 JAm#mA#Qmm##H)                       
 79mmmmmBF                       (Gmm#mm#mmmmAP`                       
   `""""\       `                ^"HmmHmQmmm!"                         
                                    ^7#mHP'                            
                                       7"                              

BTW: Have I told you that I will decrease the default width in Jave from
80 to 71?

Markus

Ilmari Karonen <ilt...@sci.invalid> ASCII art 20 Apr 2001 08:12 · permalink · report
In article <3AD...@rz.uni-karlsruhe.de>, Markus Gebhard wrote:
>
>Now if you go further and divide characters into more than 4 regions
>(e.g.3x2) it all becomes even worse and the results when I tried to do
>that were not worth considering.

Just as a data point, Rob Harley's classic bitmap-to-ascii algorithm
uses a 3x2 grid.  The details can be found near the end of Jorn Barger's
technical ascii art FAQ, archived for example at

  http://www.sci.fi/~iltzu/ascii/ada/aaatechnical.txt

FWIW, I did once write an algorithm that used a 5x5 (IIRC) grid of
grayscale values, doing least-square-sum analysis to pick the best
match.  It worked, in the sense that the output was recognizable, but it
was awfully slow and didn't look very good at all.

The major challenge in the field is IMHO developing a good non-local
asciification algorithm.  The problem, which also comes up in a way in
in ascflip, is that any algorithm that handles each character separately
is bound to yield suboptimal results in some cases due to aliasing.

-- 
 .    _, .. j u s t.  h o w l.i n g   i n  .t h e   n.i g h t .. ._,   .
,    )''        .       /\_    .     '     ,/\   .          ,    ``(  ,
_\__/ |__.'\._______,--;_'_`-.___,.______,/_,_`.__,-.__'__,/`-._,_| \____
 ,_f_)\. Ilmari Karonen  ilt...@sci.fi  http://www.sci.fi/~iltzu/  /(_|_,.

Ilmari Karonen wrote:
> 
> In article <3AD...@rz.uni-karlsruhe.de>, Markus Gebhard wrote:
> >
> >Now if you go further and divide characters into more than 4 regions
> >(e.g.3x2) it all becomes even worse and the results when I tried to do
> >that were not worth considering.
> 
> Just as a data point, Rob Harley's classic bitmap-to-ascii algorithm
> uses a 3x2 grid.  The details can be found near the end of Jorn Barger's
> technical ascii art FAQ, archived for example at
> 
>   http://www.sci.fi/~iltzu/ascii/ada/aaatechnical.txt

This is a very interesting text.
You are right, he uses a 3x2 grid, but he does not assign grey values to
this grid - it is only 1 or 0, like that:

L -> 10  / -> 01  ( -> 01
     10       10       10
     11       10       01

My 2x2-algorithm uses greyscales for the 4 areas - schematically:

L -> 50  / -> 04  ( -> 33
     88       40       33
(in the algorithm there are 256 values for brightness of each area)

On Robs site, there is a conversion of mona lisa he did with the 3x2
grid:

i`it)v|[[[[(//s+)`(-\\/JJgbdd@@@@@@@dmKK(c!(/-[2=/cct/!-v\!_L\)|
]-!/(!-)\L\)v|c5(!,!Ldd@@@@@@@@@@@@@@@@@@@dK/]!c\\\v|i\/cT\v((c-
]!`/v\//(-|t\VvcL!m@@@@@M@@@@@@@@@@@@@@@@@@@@bLt\\|)c/2-vv)/it\.
--/-,\,\v\,|)/v/m@@@@@@K@@@@@@@@@@@@@@@@@@@@@@@bK!v!-( )-!.[/cT
//.\--'--|-/c(e@@@@@@@DD@@@@@@@@@@@@@@@@@@@@@@@@@@s\\\\-||/v!c\.
-,-|\`||\-\/id@@@@@@@@N@@@@@@@@@@@@@@@@@@@@@@@@@@@@b.),`-,-/c-`i
!,\!-!-!'!-!d@@@@@@@P[+~**AAA@@@@@@@@@@@@@@@@@@@@@@@b/./`c-/.\7-
--'.-- -/,id@@@*P!`          \'Z8@@@@@@@@@@@@@@@@@@@@@i.\\'.\.c
',`,`\'-,-J@@5`-           -- `-iYA@@@@@@@@@@b@@@@@@@@@_\-|-\c-
'. -.,`/.G@@K- `               - )7KM@@@@@@@@@@@@@@@@@@@c-----/
- `-  --i@@Ai                    -!ZZ@@@@@@@@@@@@@@@@@@@b! \`|-`
 `-,'- G@@@[,                    '.D8K@@@@@@@@@@@@@@@@@@@[/-,-/.
-` .-/v@@@A)                      -)ZdMd@@@@@@@@@@@@@@@@@@\' _\
- ` ,iVJ@@@!                     '-!(K5K@@@@@@@@@@@@@@@@@@[(/s[.
  - i\G@@@Z-                    ' ! -i55ZZ@@@@@@@@@@@@@@@@@)(4)`
 , -|b@@@@!\                     '  ` |-tYG@@@@@@@@@@@@@@@@XNYZ-
   tt@@@@A-,                        '  `)(d@@@@@@@@@@@@@@@@D)8A[
   )8@@@@@\                         ,-'-/Kd@@@@@@@@@@@@@@@@@KD@[
  ]]Z@@@@d|-              ,ii.c,, -.icLZKK@@@@@@8@K@@@@@@@@@(@8[
  KN8@@@@@( .i!vGG_      J4Kb8ZKb@bbK@d@88@@@@@@@b@@@@@@@@@@dK@-
 )/8K@@@K@b@dP~~~T4(    Jd@@7`___s@M@@@@MM8d@@@d@@@@@@@@@@@@LM8[
\!48@K@@@@8@@d*@@@bVi   bAKLY~~@@@@@@*ff/\NM8@@@@@@@@@@@@@@@db@[
,\\Kb@@@d@.~t` !*~!`.  -MA)    '~'.).` `,'K@@@@@@@@@@@@@@@@@AKb[
,`8M@@@@@@ -`,,gvZ``    A//-  ..c\+\`    i]d@@@@@@M@@@@@@@@@@@8[
i\@8@K@@@D              \!'             !iZ8@@@8A@@@@@8d@b@@@8M[
e8d5@@@@@@             '!-             '-)8@@@@@@@@@@@@@@@@@@M8i
8dZ8@M@@@@-             v  ,          ,\tK@@@@@@@@@@@@A@@@@@@Z2|
@b@AK@@@b@[              //           cctbA@@@AK@@d@@d@@@K@@@bmi
@@8@M@8@@@P-            -=/.         /iD8d@@@@@@@@@@@@@@A@@@d@@[
@8@@@MA@@@@\-      .   _)g2i        -((dKK@@@@@d@@@@d@@K@@@@@@K[
@@@bAK@@K@@)i     'c,,Kb@@bK       )X)Kb@M@@d@@@Mb@@A@d@@@@@@8@[
@K@b@@@@A@AA/i-     ~M@@@@Mc    .,\c=)D8d@@b@@@d@@@@@@@@@@8d@@A[
@@@@Mb@@@@@@('c\`     PPK((,i]v|-\-v)8XNAdMK@@@@@@@b@@MK@A@@@@@[
@@8@@MK@d@A@L!--c)s_, ,(ZsbLb@\`- .-N]/KM@@@@@@@d@@@A@@@@@@@@d@[
@@Kb@@@K@b@@@/-  !''~~Vff*N5f -` -,\))KK@@@@@@@MK@@d@@@M8d@b@@@[
@b@@@KAK@@@@@@2--    ,,_JJ/i)/- |/v)NK@8d@@@@@@@@@@8@@@@@@@@M@K[
@@8d@K@@@b@@@@@d!,   'VV\)\\)\7(-)4Jb@8@A@@@K@d@@@@@@@8@@@@@@@@[
M@@@@8@@K@Kb@@@d@v.       `-\\/v)88b@M@A@K@@M@@@A@@M@8@@A@d@8@M[
Zb@d@M@K@@@@@@@@@@m       -)!/stbb@b@@A@b@@@@@Kb@@@@@@@b@@@K@@@[
K@@d@@@@@d@M@8@@@@@Ks   ,-/vJD@@8d@K@@@@@@8@@@@@@@@@@MK@@@b@@M@[
tN@b@@d@d@M@@@@@@@@@@LL4JKd@A@@d@@K@@@@MK@@@@8@@@@@@@@@@@b@@@@@[
)NM@8b@@A@@@A@@@@@@@@@@@@@@A@@A@@8@@K@d@@@@M@@K@@K@A@@@8@@M@@@@[
(tMM@@@d@@M8@@@@A@@@@A@@@A@@@@@@@@@A@@@@8b@@8d@@@@@@@@@@@@@@@@M[
tNZ@@K@@@d@@@@A@@@@@8@@@/4N@@8@b@@d@@M@8@MK@M8@K@@@@@@d@@@@@@@@[
M/KA8@@@MA@@@M@@@@@@@@@@[|t*Z@N@@@@8@@M8ZAZZ@M@@@A@d@@@@@K@@@d@[
bYJ4M@@@@@@A@@@@@@@@@@@@D.\'(YKKZD@8dK@5A84YZ@dM@@@@@@@@@@@@d@@[
K5dM8@8d@d@@@@@@@@8@@@@@@..-!/))ZK5AK4)AY(/XY/Z@@@A@@@d@@@M@@@@[
Y8dNA@@AK@@d@@@b@@@@@@@@@L,-,\!]]\X(5)Z/7c\\t5/K@@@@@@@@b@@@@@@[
8M8@@@A@@@A@@8@@@@@@@@@KDLt! !,-|t'(-\\!,\/,\!ZJG@@@d@Md@@@G@@@[
                                   rob...@vlsi.cs.caltech.edu

Here is about the same image converted with my 2x2 algorithm:

>:-({(>=>(:(>=>(--(>(:(>((aaaaaaagaeeu(a--(((-(>(>-:-----------(
((:((>>((>=((({>--((aagggMMMBMMMBMMMMMMmmQQas:(((-((---(-----(((
(:::(((((>:(>:::(agMMBBMMMMMMMMMMMMMMBMMMMMMMmQeo:-----(-------(
-----------(--aggMMMMBMMMMMMMMMMMMMMMBMMMMMMMMMBMQe-------------
-----------(agMMMMMMMBMMMMMMMMBMMMMMMMMMMMMMMMBBMMMmy-----```---
-------`-((gMMMMMBMMMMMMMMMMMMMMMMMMMMMMMMMMMMMBMMMMMme--.` .---
----`----(gMMMMMMWF8V%=7VV99TWWMMMMMMMMMMMBMMMMMMMMMMMBQ--..--.-
-``` ...(MMMM8v:----.`..`--((:(zO#MMMMMMMMMMMMBMMMMMMMBMma..---.
   ..--(MMBKx=>``          ``--(?OZ#MMMMMMMMMMMMMMMMMMMMMBy-.` .
   ..-aMMBK|--`              .--(=zZX#MMMMMBMBMMMMMMMBMBMMMy-.  
   `.aMMMB[(-`                .--(c4ZS#MMMMMMMMMMMMMMMBMMBMmy-. 
   -JMMBBD{--.               .--(:{z0X#MMMMMMMMMMMMMMMMMMMMMm-..
  _zwgBMB#{---  `  -`       .--((>(=v0Z9HMMMMMMMMMMMMMMMMMMMMm((
 _ngBMBMR0>---..     ``     .`---((>==vv0UXSMBMBMMMMMMMBMMMBMBnx
_2gMMMMBD=>---`-.           -----------({z4dMBMMMMMMMMMMMMMBMMAx
-4dMBMBBX=---..... ..    ..---------(((uxwQdMMMBMMMMMBMMMMMMMMmO
QQdMMMMMm{(-((((a----...(aagQQQwwwwsgwQQQQ#MMMBBMBMMMMMMMMMMBMEQ
Q#MMMMMMmQggQU99#Aw----(gMMBMF8VU#MMMMBMMBMMMMMBMBBMMMMMMMMMMMM#
##BMMMMMMMMmQZmmmQZk--(4MMMHZ0VMMMMBMMMMW9VX#MMMMMMMMMMMMMMMBMBm
dMMMMMMMD?98=-3T880z- (dM#D=-.-(VV9OZ0>---(4#MMMMMMMMMMMMMMMMMME
dMMBMMMBr:::>>zZUv::--(4#X6=::>=?v0">:---(z4#MMMMMBMMMMMMMMBMMMB
#MMMMMMB|-.  ..```--``(zvvv--`       ---((xdMMMMMMMMMMMBMMMMMMMB
#dMMMMMBk----`   ---  (:==:--.     ..--(zxg#MBMMMMMBMBMMMMMMMMMM
BMMMMMMMm>--`.  .--.  -((>(----.  ---((z4QdMMMBMMMMMMMMMMMMMMMMM
MMBMMMMMBn----..-(-`  ((cz[>----.----((wdddMMMBBMMMMMMMMMMMMMMMM
MBMMMMMMMmo------(--._(agggk-------((zwQS##MMMMBMMMMMBMMMMMMBMMM
MMBMMMMMMBQx(-----7jagMMMBMR--.-(-(uzZQQ#MMMMMMMBMBMMBMMMMBMBMMM
BMMMMMMMBM#Oxoo:--..?MMMMW8[(((uoz=z4QXQS#MMMMMBMBMBMBMMBMMMBMMM
BM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's advantages and disadvantages (I don't like the lines
(e.g. "----") in my conversion...

> FWIW, I did once write an algorithm that used a 5x5 (IIRC) grid of
> grayscale values, doing least-square-sum analysis to pick the best
> match.  It worked, in the sense that the output was recognizable, but it
> was awfully slow and didn't look very good at all.

Can you post an example? (The source image for mona lisa can be found at
http://www.jave.de/image2ascii/competition2001/stage1.html ).

> The major challenge in the field is IMHO developing a good non-local
> asciification algorithm.  The problem, which also comes up in a way in
> in ascflip, is that any algorithm that handles each character separately
> is bound to yield suboptimal results in some cases due to aliasing.

I think the greatest problem are structures like "..." or "---". The
human eye tries to connect them and makes lines appear in the image that
where not there in the original one.

Markus

> This is a very interesting text.
> You are right, he uses a 3x2 grid, but he does not assign grey values to
> this grid - it is only 1 or 0, like that:
>
> L -> 10  / -> 01  ( -> 01
>      10       10       10
>      11       10       01
>
> My 2x2-algorithm uses greyscales for the 4 areas - schematically:
>
> L -> 50  / -> 04  ( -> 33
>      88       40       33
> (in the algorithm there are 256 values for brightness of each area)

I would like to see what change a 3 x 3 grid would do.

could the fuzzylogic algorithm i mentioned be implemented as a 6 x 9 (just an example..
the real grid should be the size of the amount of pixels a char takes) or perhaps as half
the size of this ..
I think it could.



[SNIP - Mona Lisa]

> You have to decide for yourself which one looks better. Each of them
> has it's advantages and disadvantages (I don't like the lines
> (e.g. "----") in my conversion...

I like yours better Markus.
And I don't like the ---- 's either.
I feel there also is a need to restrict the 2x2 algorithm to certain characthers .. just
like the 1x1 algorithm.
This also makes it able to make stylized images like the picture of Gwyneth Paltrow.

Further improvements I can think of :
Find the perfect set of chars to use .. I'm currently doing this with the 1x1 .. I have
been able to get a few improvements so far.
And find a way to interpolate two grids ..

F.x if a grid needed a line at the very top , it might in some cases be better if the _
was used in the grid/cell above it .. the current algorithms do not consider that.

Perhaps a algorithm could do a larger pixelgrid to a larger chargrid .. f.x if your 2x2
algorithm instead was 4x4 to 2x2 chars

or maybe just a 3x1 char grid

 _
|_|
|_|
|_|

Since most "crossover" chars have to do with height

> I think the greatest problem are structures like "..." or "---". The
> human eye tries to connect them and makes lines appear in the image that
> where not there in the original one.

As I said .. try to restrict the charset for the algorithm

Christian 'CeeJay' Jensen wrote:
> > L -> 10  / -> 01  ( -> 01
> >      10       10       10
> >      11       10       01
> >
> > My 2x2-algorithm uses greyscales for the 4 areas - schematically:
> >
> > L -> 50  / -> 04  ( -> 33
> >      88       40       33
> > (in the algorithm there are 256 values for brightness of each area)
> 
> I would like to see what change a 3 x 3 grid would do.

Feel free to implement it :-)

As stated before I do not see advantages. It will become an unsolvable
puzzle - have a look at this:

IMAGE:     A:    B:    C:
 505       800   400   008
 505       080   500   012
 505       008   781   312

Suppose in the image you found a grayscale pattern like in 'IMAGE'. You
can substitute this pattern by one of three avialable characters with
reference patterns A, B, and C. But none of them fits. Which one will
you use? The one with the least difference - but the differences here
are all by far too big. The result will not be likely to look similar to
the original image.
In Ascii you have about 94 characters or so to chose from - a little bit
more than the three ones in the example above, but by far to few to
cover a 3x3 grid.
To get a better idea of the problem have a look at this:
  http://www.jave.de/preview/9x9.gif

I have done a little testing with the 3x3 grid some time ago. I have
stopped as I realized the fact I wrote about above. Here an example of
what it looked like:

1) The 2x2-Algorithm:

MMMMMMMEM#mmyMMTxZ0(:--((x>>-(>>{zv==:::------`-``    `(3X#MMMBB:JdMMBMM
MBMBMBMMMKMMBZSwY={z>---(3>-(zz====>(:((---------...   .(d#MMMB#n(XBMBMM
MBMEMB#MBMMMTgP%(=>{{----((awxo{{>>:(((((----------.. ..(4QMMMMBm(dMMMMM
MMMBMBBMMBMSQ+>::-(z=---(499UUQQQQwe-((((:----------.__aggMMMMBBm(3MMBMM
MMMMmQMMMWn2%(>--(z=-_JQQxxgyzwQX#MM#Q{>>((-------(agX##XQQ#MMMBB{zdMBMM
MMMMMMMMT4f>::---(:(a#mmMMMMMmMMmQXZZZOxoz>-----(ugggMMMMMMMMMMEM|3QMMMM
mgMMMMMKx+->:----(a#MMMMMMMMB+V@MMMQxZO[xz=--`.(gMMMMF#MM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Z@EE
E2%-qBBEEEEEZZZZZZZZZZ22222%222ZZZZZZZZZZZZ2%  2ZZZZZZZZZEEEEBEBBESZZZBE
P%_gEBBEEEEEEZZZZZZZZZZZZ222222ZZZZZZZZZZZZ2%  %ZZZZZZZZEBBBEEEHBEEZZZBE
zzdBBBBEEEEEEZZZZZZZZZZZZZZ222ZZZZZZZZZZZZZZ%- <ZZZZZZZZBBEBEEEBBEEZZZEB
LQBBBEEEEEEEZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ2%-zZZZZZZZBBBEEEEEBBBESZZ@B
BBWBBBBEEEEEEZZZZZZZZZZZZZZZZZZZZZZZZZEEZEEZZ%z2ZZZZZZBEEBEEEBEBEBBEZZZB
BBBBEBBEZEEEZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ2%%%2ZZZZZZBBEBBEEEEEEEEBESZZE

On the line from the hair on the left you can see that forms are
approximated better, but for the overall result there is not much to be
said about...

> And I don't like the ---- 's either.

I could remove '-' from the gradient. But I think it is no good idea to
also remove '.' - one has to find a way to reduve those artefacts from
continuous characters by dithering I think.
 .'.'.' is much better than .....

> I feel there also is a need to restrict the 2x2 algorithm to certain characthers .. just
> like the 1x1 algorithm.

That's problematic. You want to remove certain characters, for they
create artefacts like lines for example. But on the other hand you want
to convert shapes in the image to shapes from characters - that is a
contradiction.

> F.x if a grid needed a line at the very top , it might in some cases be better if the _
> was used in the grid/cell above it .. the current algorithms do not consider that.

Good idea, but by using '_' on the line above, you lose a character at
this place that might be needed much more.

> Perhaps a algorithm could do a larger pixelgrid to a larger chargrid .. f.x if your 2x2
> algorithm instead was 4x4 to 2x2 chars
> 
> or maybe just a 3x1 char grid
> 
>  _
> |_|
> |_|
> |_|
> 
> Since most "crossover" chars have to do with height

Maybe a good idea, but one has to put lots of effort in creating a good
translation table. If you want to do that automatically (I suppose so)
the only algorithms that come to my mind will not lead to different
results from the original algorithm...

Markus

About this thread. These messages were posted publicly to the newsgroup alt.ascii-art in 2001 and are mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you one of the authors? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post