a python library to draw with ASCII (but with Unicode)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
746 B

  1. #!/usr/bin/env python3
  2. """
  3. Uses an image as a guide to draw either blanks or
  4. mark chars. In this case with the char '+'.
  5. """
  6. from asciiWriter.patterns import image
  7. from asciiWriter.utils import make_lines, visit, print_lines
  8. from asciiWriter.marks import single, space
  9. width = 75
  10. height = 75
  11. # Where to find the image
  12. image_path = 'images/blobs-small.png'
  13. # Construct the pattern
  14. image_pattern = image(image_path)
  15. # Set the marker, in this case the character '+'
  16. mark = single('+')
  17. # Define what to use on a blank space, as a variation you could use: single('*')
  18. blank = space()
  19. # Make a canvas
  20. lines = make_lines(width, height)
  21. # Draw the picture
  22. result = visit(lines, image_pattern, mark, blank)
  23. # Print the result
  24. print_lines(result)