Convert any Image into ASCII Art for a Custom Spring Boot Banner

If you’d like to override the standard Spring Boot banner with something custom, then you’ve come to the right place. Find any image you want to convert to ASCII art. Then, download the following Git Hub project

Now, you can run a script like the following:

./image2ascii -f ~/Downloads/trinity-neo-morpheus-2.jpg -g 57 -w 100 | tee banner.txt

You’ll see something like the following print out (in color):

Trinity, Neo and Morpheus ASCII Art

Now, you simply can put this file banner.txt into the appropriate folder in a Maven built Java project. If you put it into a common library with Autowiring, it will be available more readily to all of your dependent projects.

  • src/main/resources/banner.txt

Now, you can just build and run and you’ll see this print out without any further configurations (following convention over configuration). If you really want to tweak the configurations you can use some of the following properties in the application.properties 


spring.banner.charset: It configures banner encoding. Default is UTF-8
spring.banner.location: It is banner file location. Default is classpath:banner.txt
spring.banner.image.location: It configures banner image file location. Default is classpath:banner.gif. File can also be jpg, png.
spring.banner.image.width: It configures width of the banner image in char. Default is 76.
spring.banner.image.height: It configures height of the banner image in char. Default is based on image height.
spring.banner.image.margin: It is left hand image margin in char. Default is 2.
spring.banner.image.invert: It configures if images should be inverted for dark terminal themes. Default is false.
spring.main.banner-mode=off

As, you can see you can use images as well. Also, if you were so inclined, you could even use variable substitution in your ASCII art for printing things out, such as the application name and version number.

Leave a Reply

Your email address will not be published. Required fields are marked *