new render for swastikas and other rubbish
This commit is contained in:
parent
25cf9ec7cf
commit
d6d42a03e6
@ -66,8 +66,8 @@ def render_text_on_image(input_image_path, text_to_draw, output_image_path=None,
|
|||||||
return file
|
return file
|
||||||
|
|
||||||
|
|
||||||
WIDTH = 22
|
WIDTH = 29
|
||||||
HEIGHT = 9
|
HEIGHT = 10
|
||||||
|
|
||||||
|
|
||||||
def image_to_string(image_file):
|
def image_to_string(image_file):
|
||||||
@ -79,7 +79,7 @@ def image_to_string(image_file):
|
|||||||
|
|
||||||
# Get image dimensions
|
# Get image dimensions
|
||||||
width, height = img.size
|
width, height = img.size
|
||||||
if width != 22 or height != 9:
|
if width != WIDTH or HEIGHT != 9:
|
||||||
raise ValueError("The image must be exactly 22x9 pixels.")
|
raise ValueError("The image must be exactly 22x9 pixels.")
|
||||||
|
|
||||||
# Create the string representation
|
# Create the string representation
|
||||||
@ -89,9 +89,9 @@ def image_to_string(image_file):
|
|||||||
# Get the pixel value (0 for black, 255 for white)
|
# Get the pixel value (0 for black, 255 for white)
|
||||||
pixel = img.getpixel((x, y))
|
pixel = img.getpixel((x, y))
|
||||||
if pixel == 0: # Black pixel
|
if pixel == 0: # Black pixel
|
||||||
pixel_string += "Ń"
|
pixel_string += "◌"
|
||||||
else: # White pixel
|
else: # White pixel
|
||||||
pixel_string += "…"
|
pixel_string += "●"
|
||||||
pixel_string += " " # New line for each row
|
pixel_string += " " # New line for each row
|
||||||
|
|
||||||
return pixel_string
|
return pixel_string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user