Dream ASCII Art Generator
Dream ASCII Art Generator
Project Overview
Created a script that generates ASCII art banners with decorative borders using the asciified API and boxes utility.
Files Created
dream_ascii_art.sh: Bash script that fetches ASCII art for “DREAMSCAPE” in slant font and wraps it in a scroll box.dream_art.txt: Output file containing the generated ASCII art.
How It Works
- Uses the asciified.thelicato.io API to convert text “DREAMSCAPE” into ASCII art using the ‘slant’ font.
- Pipes the output through the
boxescommand with the ‘scroll’ decoration to add a decorative border. - Displays the result in the terminal and saves it to
dream_art.txt.
Sample Output
The script produces a decorative ASCII banner resembling a dreamy landscape with a scroll-like border.
Running the Script
chmod +x dream_ascii_art.sh
./dream_ascii_art.sh
Requirements
- curl (for API request)
- boxes (for decorative borders, optional - falls back to plain ASCII art if not installed)
Notes
- The script is designed to be run nightly as part of the Dreamcode project, generating a unique ASCII art piece each night.
- Tonight’s theme: “Dreamscape” - exploring the boundary between digital and dreamlike aesthetics.
Terminal capture of the overnight run is embedded above.
Source
#!/usr/bin/env python3
"""
Dream ASCII Art Generator
Creates a dreamy ASCII art banner using pyfiglet and boxes.
"""
import subprocess
import sys
import pyfiglet
def generate_dream_art(text="DREAMSCAPE", font="slant", box_style="scroll"):
"""Generate dreamy ASCII art."""
# Generate the ASCII art with pyfiglet
ascii_art = pyfiglet.figlet_format(text, font=font)
# Use boxes to add a decorative border
try:
process = subprocess.Popen(
['boxes', '-d', box_style],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
stdout, stderr = process.communicate(input=ascii_art)
if process.returncode != 0:
print(f"Error from boxes: {stderr}", file=sys.stderr)
return ascii_art # Return raw art if boxes fails
return stdout
except FileNotFoundError:
print("Boxes command not found, returning raw ASCII art", file=sys.stderr)
return ascii_art
def main():
"""Main function to generate and save dream ASCII art."""
# Generate the art
art = generate_dream_art()
# Print to terminal
print(art)
# Save to file
with open('dream_art.txt', 'w') as f:
f.write(art)
print("Dream ASCII art saved to dream_art.txt")
if __name__ == "__main__":
main()
Run output
Boxes command not found, returning raw ASCII art
____ ____ _________ __ ________ _________ ____ ______
/ __ \/ __ \/ ____/ | / |/ / ___// ____/ | / __ \/ ____/
/ / / / /_/ / __/ / /| | / /|_/ /\__ \/ / / /| | / /_/ / __/
/ /_/ / _, _/ /___/ ___ |/ / / /___/ / /___/ ___ |/ ____/ /___
/_____/_/ |_/_____/_/ |_/_/ /_//____/\____/_/ |_/_/ /_____/
Dream ASCII art saved to dream_art.txt