Skip to content

Commit

Permalink
Merge pull request #12 from WSE-research/main
Browse files Browse the repository at this point in the history
Merge recent changes
  • Loading branch information
anbo-de authored Dec 28, 2023
2 parents c25af6c + 06442a7 commit e1090bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ PAGE_ICON = "images/image-to-ascii-art-logo-2.png"
PAGE_IMAGE = "images/image-to-ascii-art-logo.png"
GITHUB_REPO = "https://github.com/WSE-research/image-to-ascii-art"
DESCRIPTION = "\nYou want to create ASCII art from a given picture? Then you've come to the right place. This tool provides a **fast and automated** way to interactively create ASCII art from an existing image (either uploaded from your local machine or download from a URL). You might use this in your applications (e.g., in the `banner.txt` file of [Spring Boot applications](https://www.baeldung.com/spring-boot-custom-banners)). Several methods are implemented here in different approaches for convenient comparison. Some support colorized characters, or colorized background of characters, taking the colors from the given image (see [full feature list](https://github.com/WSE-research/image-to-ascii-art/#image-to-ascii-converter)). Choose for yourself the best approach regarding your image and use case. Have fun.\n\nSee the sidebar for configuring this tool's behavior. For more details, see our [GitHub repository](%s) where you can also [submit bug reports](%s) and [feature requests](%s)."
META_DESCRIPTION = "Create fast and automated ASCII art from images. Upload images or download from a URL. Compare methods interactively, including color/background options. Ideal for applications like Spring Boot banner.txt files."
META_DESCRIPTION = "Create fast and automated ASCII art from images. Upload images or download from a URL. Compare methods interactively, including color/background options. Ideal for applications like Spring Boot banner.txt files."
REPLACE_INDEX_HTML_CONTENT = True
CANONICAL_URL = True
CANONICAL_URL = https://wse-research.org/image-to-ascii-art/
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ ENV COLORTERM=24bit
# set environment variables for the application
ENV UPLOAD_DIRECTORY=/app/working_directory

# do a dry run to see if the applications would starts (so, we are not surprised if it doesn't work during the real start of the container)
RUN (export DRY_RUN=True; export UPLOAD_DIRECTORY="/app/working_directory"; streamlit run image-to-ascii-art-converter-web-ui.py &) && sleep 5 && curl http://localhost:${SERVER_PORT}/

EXPOSE $SERVER_PORT
HEALTHCHECK CMD curl --fail http://localhost:$SERVER_PORT/_stcore/health

Expand Down
6 changes: 6 additions & 0 deletions image-to-ascii-art-converter-web-ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ansitoimg.render import ansiToSVG
from util import include_css, download_image, save_uploaded_file, replace_values_in_index_html
import json
import signal

UPLOAD_DIRECTORY = config('UPLOAD_DIRECTORY')
EXPORT_IMAGE_ENDING = "-ascii-art.png"
Expand Down Expand Up @@ -47,6 +48,11 @@

conv = Ansi2HTMLConverter()

# if the dry run is enabled, we will stop the script
if config('DRY_RUN', default=False, cast=bool):
logging.info("dry run enabled, will stop script, now")
os.kill(os.getpid(), signal.SIGTERM)

ascii_image_converter_with_colors = "With colors (I)"
ascii_image_converter_with_colors_complex = "With colors (II)"
ascii_magic_with_colors = "With colors (III)"
Expand Down

0 comments on commit e1090bb

Please sign in to comment.