An API to convert any image into ASCII

Girl with the pearl earing ASCII

 

Who doesn’t love ASCII art?

There are the true artists who create art themselves, a character at a time. For the rest of us, there are lots of great ASCII art generators, for instance Picascii or Text Image.  One thing they are missing though is an API to handle the image-to-ASCII conversion.  When we were building our API for image transformations, we had to include things like resize, compress, and crop but we wanted to include ASCII because it’s just awesome. This post is about this cool feature. As you’ll see, with this online tool that works as a png converter, modifying image files has never  been easier.

Key Takeaways

  • Easy Conversion: Filestack’s API lets you transform various image formats (JPG, PNG, PSD, etc.) into ASCII art using simple URL parameters to customize colors, size, and effects.
  • Versatile Output: The service generates HTML-based ASCII art that can replicate single-color or multi-color images, with options like reversing the character set for better contrast.
  • Free & Feedback-Driven: The basic conversion is free to use, and users are encouraged to provide feedback or suggestions to help refine and enhance the tool further.

This blog will convert an jpg to ASCII in the example, but you can also automatically convert the following file types to ASCII using our API: png, ai, psd, tiff, bmp.

Let’s go!

The Filestack transformation API

The Filestack transformation API is really simple to use.  Basically, you send a request to our transformation endpoint along with your API key and task.  You can programmatically interact with our API, but in these examples, I’ll just show you how to convert to ASCII by adding conversion tasks to at URL.

Here is how the Transformation URL is structured for an image hosted on some server or object store like Amazon S3.

You can see there are three parts: your API key, the conversion task (in our case convert-to-ascii), and the url of the image we want to convert.

Screen Shot 2017-01-26 at 10.33.56 AM

How to convert any image into an HTML file of ASCII Art

Ok, with the basics out of the way, let’s see how the Filestack transformation engine can take any image file and turn it into an HTML file of ASCII Art by simply passing these few url parameters to the Filestack API.

Here is the structure of the Image to ASCII task.

Image to ASCII Task URL Format:

https://process.filestackapi.com/<API_KEY>/ascii=[options]/File_URL

File_URL is the url of the image that you want to convert.  This could be any image hosted on any server, but most commonly will be something stored on an object store like S3, Azure Blob store or Google Storage.

The options are:

ascii=background:white or #FF0000

where you specify a background color for the HTML file from our list of accepted color names or a hex color code. You can even opt for a transparent background if that is what you like.

Same thing goes for the foreground color.

ascii=foreground:red or #FF0000

This is the font color that will make up the image.  Specifying the foreground option will create a single color image.

If you want a multi-color image, you can use the colored option.

ascii=colored:true

When set to true, this reproduces the colors in the original image. This works best with a dark HMTL background as you’ll see below.

You can also use the size attribute to specify the size of the returned file as a percentage of the original. The parameter must be an integer between 10 and 100. The default is 100. This online tools makes it easier for you to format image files to your own needs and expectations.

ascii=size:10 to 100

You can also reverse the character set used to generate the ASCII output. This works well with dark backgrounds and requires color:true

ascii=reverse:true

With the details out of the way.  Let’s look at some of the world’s most famous paintings as ASCII art!

In no particular order, here are some of the world’s most famous paintings in ASCII.  If you don’t see the ones you would have picked, give it a try and Tweet us a link via Twitter.

(BTW, for display purposes on the blog, I’ve included the ASCII as images, but if you click on each image itself, you’ll get the full HTML page with the ASCII art.  For comparison, you can click on the hyperlink to see the original.)

The great wave off of Kanazawa Hokusai ASCII

 

Screen Shot 2017-01-27 at 3.10.33 PM

 

Self portrait Frida Kahlo ASCII

 

 

American Gothic Grant Wood ASCII

 

Mona Lisa Leonardo Da Vinci ASCII

 

Van Gogh Starry Night ASCII

 

The Scream Edvard Munch ASCII

 

The persistence of memory Salvador Dali ASCII

What else can I do?

Filestack does a lot of other image transformations, using the same patterns as above. Here is a complete list of all the transformations that Filestack can do, with a link to the relevant page in documentation:

Compress
Watermark
Facial Detection
Crop
Rotate
Border and Effects
Filters
Collage
Image Enhancements
URL Screenshot
Image to ASCII
File type conversions
Zip

How to Provide Feedback or Suggestions for the Ascii Art Generator

We’re always eager to hear from you—whether you have ideas to improve our conversion tools or simply want to share your experience using our ASCII art generator. If you’ve used our service to convert a JPG, PNG, or even an SVG into an ASCII masterpiece, please let us know what worked well and what could be better!
You can provide your feedback or suggestions in several ways:

  • Social Media: Tweet us your thoughts or tag us in your posts showcasing the ASCII art you’ve generated. We love seeing how users turn images into unique ASCII art using our tool!
  • Email or Contact Form: Reach out directly through our website’s contact page to share detailed feedback or suggestions on features like multi-color ASCII conversion or additional customization options.
  • Community Forums: Join our discussion groups or forums where fellow users talk about tips and tricks for turning images into ASCII art. Your ideas might inspire new features in future updates!

Your input is invaluable in helping us refine the tool—from ensuring that phrases like “make upper case lower case” or “ascii image maker” are understood correctly, to fine-tuning the conversion process for optimal results.

 

Is the Ascii Art Generator Free to Use?

Yes, our ASCII art generator is free to use! Whether you’re converting a JPEG to ASCII or creating detailed art from a PNG, you can enjoy these features without any hidden charges. Here’s what you need to know:

  • Free Conversion: You can quickly and easily convert your images—be it JPG, PNG, or even complex formats like PSD or TIFF—into ASCII art without cost. This makes it a fantastic tool for designers, hobbyists, or anyone curious about turning images into text-based art.
  • API Access: The Filestack transformation API is designed to be straightforward. With your API key, you can integrate the image-to-ASCII functionality into your projects, testing features like reversing the character set or applying custom foreground and background colors.
  • Usage Options: While the basic service is free, if you require heavy usage or more advanced features, you might want to review our pricing plans. This ensures that everyone—from casual users to developers building robust applications—finds the right solution.

Enjoy creating your ASCII art and let your creativity shine as you turn any image into a captivating text-based masterpiece!

 

FAQs

Q1: What image formats can I convert to ASCII art using this tool?

You can convert a variety of image formats including JPG, PNG, AI, PSD, TIFF, and BMP. This flexibility makes it a great solution for both simple and complex image files.

 

Q2: Can I customize the appearance of the ASCII art?

Absolutely! You can adjust parameters such as background and foreground colors (using names or hex codes), image size (as a percentage of the original), and even reverse the character set for better contrast. There’s also an option to generate multi-color art that reproduces the original image’s hues.

 

Q3: Is there any cost to using the ASCII art generator?

No, the basic conversion to ASCII art is completely free. If you need advanced features or higher usage levels, you can review our pricing plans for more options. Feedback is also welcome to help us continually improve the tool.

Read More →