Your code can also be modified to be more efficient with StringBuilder:.If ( avgBrightness < 51 ) sb.Append( '█' ) Įlse if( avgBrightness < 102 ) sb.Append( '▓' ) Įlse if( avgBrightness < 153 ) sb.Append( '▒' ) Įlse if( avgBrightness < 204 ) sb.Append( '░' ) Single avgBrightness = ( (Single)r + (Single)g + (Single)b ) / 3f Throw new NotSupportedException( "meh" ) Int32 bytesPerPixel = ( bitmapData.PixelFormat ) / 8 StringBuilder sb = new StringBuilder( capacity: bitmapData.Width * bitmapData.Height ) Rectangle r = new Rectangle( x: 0, y: 0, width: bitmap.Width, height: bitmap.Height ) īitmapData bitmapData = bitmap.LockBits( rect: r, flags: ImageLockMode.ReadOnly, bitmap.PixelFormat ) Using( Bitmap bitmap = (Bitmap)( imageFile.FullName ) ) Something like this: unsafe static String RenderPixelsAsAscii_LockBits( FileInfo imageFile ) You can significantly increase performance by using Bitmap.Lockbits instead of iterating over.Problem 2: Performance Use Bitmap.Lockbits: I also made a version that uses Unicode block chars, just to make sure I was decoding the image correctly: static readonly Char _chars = new
The ASCII Art Generator also allows you to convert simple words into large, spectacular inscriptions. Of course, you can not only adjust the text during the conversion process, but also create text inscriptions from scratch. With its help you will be able to give your work individuality, adjusting the type of font, changing its size, adjusting the height of the line, etc. The ASCII Art Generator program has a built-in visual editor, which will allow you to control the process of converting an image to text in real time. With the help of this program you will be able to add to any e-mail message, blog, signature on the forum or on the wall in a social network, such as Vkontakte or FaceBook spectacular composition of characters and letters, which will create a unique picture.
It is worth noting that the ASCII Art Generator program has a simple and intuitive interface that allows you to use its basic features very easily.Īnd the uniqueness of this software is that the ASCII Art Generator makes it very easy to implement your almost any ideas in the field of graphic art. To create a text image you just need to take a photo or find the desired image you want to convert on your computer, then open it in the application, set the parameters and start the conversion process. You will be surprised how fun and easy it is to work in this program. ASCII Art Generator is an application that can easily and quickly convert any image into full-color or black-and-white beautiful text.