logo
logo
Sign in

An API to convert any image into ASCII

avatar
File Stack
An API to convert any image into 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 picture-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.

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.

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.

collect
0
avatar
File Stack
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more