This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-02-05 14:24:12

Necromaster
Scratcher
Registered: 2010-04-07
Posts: 1000+

I do ASCII art!

Just ask. Example:

Code:

               ....,..                                                     
                    ...:ND.                                                     
                    ...MMOM.                                                    
                    ...MM$7M. .                                                 
                    ..8MMM7M?.                                                  
                    ..DMMMM8N,.                                                 
                    ..DMMMMMM..                                                 
                    ..MMMMMM...                                                 
                    ..7MMMM= .                                                  
                    .,.MMMM.                                                    
                    ...MMMM.                                                    
                   . ,NMM7M....                                                 
                    .MNMM+M .                                                   
             .......MMN7M?$$.. ...                                              
             ......NMM+DM?+M......                                              
             .....~MM+?DN??M:....                                               
             ....,M+O??DD??=M.....                                              
             ....MND?+?O8????M....                                              
             ....M+M+++?$???+D8...                                              
             .. I7?++???M?+??+M...                                              
             ..,M?????7+++?????M++....                                          
             ..ZM?+7MMMMM8+??+NMMMM$                                            
             ,.M+?MMMMMMMMM?7MMMNNMMM....                                       
             ,NZ?+MMMMMMMMM=+M:MMMMMM ...                                       
             .MMMNMDMMMMMMMMNMNMMMMMM....                                       
             :N=???MMMMMMMM+?+MMMMMM. ..                                        
             O=++?++MNMMMM=??+M~ZMIM$....                                       
          .. N+++?+?=+~++++?MMI??7MMM....                                       
             M7+++?=MMMZ??+?+?I+?++=NM. .                                       
          .  N7?++?+???M=?+??+????++=M..,                                       
            .IM?+?+??+?DM=+??+?OM=???$M..                                       
             .M=?=?+=+?ODMN++=ZM+???+MMN........                                
             .$M???M?=+M=???I?+???8MN+?DM..... .                                
             ..N+=M?MNMD+++++++?+?+=????M......                                 
             ..$M?IM????+++++?NM???++????M+.....                                
             ...M=+M=?+?+?++???MD???+??+?~M7...                                 
             ...~7?=M+?++?++?++I8M??+++??+?DM...                                
             ....M~?=M++?++???+??+M+???++??++M.                                 
             .....M??+M++?+?++?+??=MD?+???++?+M,   .                            
             .... .M?+?M=?++???+?+=++MZ+??+?+++8. .                             
                 ...M+?+M++??+?++??++?MM==+??+++D=.....                         
                    ,M~??7M?=+?++??+????D8+?=??+??M=...                         
                   ...M?++?MD++??++??+???+MZ=+?+?++NM..                         
                    ...~O++++DM+????+???++++8Z+=++++?MM ..                      
                    .....MN?+++8MZ++??+?????+??M?+?+?++MM..                     
                    .. ...MZ+??=?ZM??+???+++??++8MO+?++?IMM...                  
                    .. ....$M7?+???+$M++++++++++??+?MMZ+??+MM=...               
                    .. ......MM++?+?+?OMM+++++?++???++?MMMMMMMMMD               
                       .........NM?++?+?+~DMN?+???+??+??+MMMMMMMMM              
                                 .$M$?????+??7DMMZ+=???~MMMMMMMMMM              
                               .. ....DM7??+??++???+~+~MMMMMMMMMMM              
                                  .........,ZMMNNZ7ZZ7$MMMMMMMMMI               
                                  ... ..............,..... ... ...              
                                  ....................... .....

It is banana  big_smile

I'll make siggy sized ASCII too.

Offline

 

#2 2011-02-05 14:25:34

kimmy123
Scratcher
Registered: 2008-05-20
Posts: 1000+

Re: I do ASCII art!

Can you do http://2.bp.blogspot.com/_j-5leje8ehE/TNmkiWv5NgI/AAAAAAAAFNA/S6hCu8J3wPw/s1600/summer-wars-love-machine.jpg?


http://i.imgur.com/Mg3TPIE.pnghttp://i.imgur.com/rgyzXV5.pnghttp://i.imgur.com/685FKVd.pnghttp://24.media.tumblr.com/8678e33865664f328e1654109679cb92/tumblr_mm1qu3jGD71s8caito3_r1_250.gif

Offline

 

#3 2011-02-05 14:29:07

Necromaster
Scratcher
Registered: 2010-04-07
Posts: 1000+

Re: I do ASCII art!

It might not turn out well... I programmed my own generator in C++

Offline

 

#4 2011-02-05 14:43:11

johndo77
Scratcher
Registered: 2010-07-30
Posts: 1000+

Re: I do ASCII art!

Necromaster wrote:

It might not turn out well... I programmed my own generator in C++

Awesome! Can you copy and paste the code?


Crizapples

Offline

 

#5 2011-02-05 14:48:17

TheGameMaster1231
Scratcher
Registered: 2009-07-24
Posts: 1000+

Re: I do ASCII art!

Can you do a sig sized awesome face?

Just wanna see how well your program works.

Offline

 

#6 2011-02-05 14:57:29

Necromaster
Scratcher
Registered: 2010-04-07
Posts: 1000+

Re: I do ASCII art!

johndo77 wrote:

Necromaster wrote:

It might not turn out well... I programmed my own generator in C++

Awesome! Can you copy and paste the code?

It only does BMP though... I added some comments in.

Code:

// Primitive BMP to ASCII art generator
// Reads source.bmp and outputs art.txt
// Source must be 24-bit .bmp
 
#include <iostream.h>
#include <windows.h>
 
#define MAX_SHADES 10
 
BITMAPFILEHEADER bfh;
BITMAPINFOHEADER bih;
RGBTRIPLE *image;
DWORD written;
HANDLE hfile;
int imagesize;
char shades[MAX_SHADES] = {'#','$','O','=','+','|','-','^','.',' '};
char return1 = 0x0D;
char return2 = 0x0A;
int needle = 0;
int average_color = 0;
 
int main()
{
     // Open a channel to source file
     hfile = CreateFile("source.bmp",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,NULL,NULL);
     // Read header
     ReadFile(hfile,&bfh,sizeof(bfh),&written,NULL);
     ReadFile(hfile,&bih,sizeof(bih),&written,NULL);
     // Read image
     imagesize = bih.biSizeImage;
     image = new RGBTRIPLE[imagesize];
     ReadFile(hfile,image,imagesize*sizeof(RGBTRIPLE),&written,NULL);
     // Close source file
     CloseHandle(hfile);
     // Open channel to output
     hfile = CreateFile("art.txt",GENERIC_WRITE,NULL,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
     // Keeping in mind the image is upside down, convert and write it
     // It down-samples the image a bit in res too
     for(int y = bih.biHeight-1;y >= 0;y--)
     {
          for(int x = 0;x < bih.biWidth;x++)
          {
               // Get the average color
               average_color = (image[x+y*bih.biWidth].rgbtBlue+image[x+y*bih.biWidth].rgbtRed+image[x+y*bih.biWidth].rgbtGreen)/3;
               // Convert to a shade of 8
               average_color /= (256/MAX_SHADES);
               if(average_color >= MAX_SHADES)
                    average_color -= 1;
               // Output
               WriteFile(hfile,&shades[average_color],1,&written,NULL);
               //WriteFile(hfile,&shades[average_color],1,&written,NULL);
          }
          WriteFile(hfile,&return1,1,&written,NULL);
          WriteFile(hfile,&return2,1,&written,NULL);
     }
     // Close handle to output
     CloseHandle(hfile);
     return 0;
}

Offline

 

Board footer