文章
闲聊

故人花鸟风月之灵位

最喜欢花鸟风月 红酒
最喜欢花鸟风月  ·  2024年12月29日 老去诗篇浑漫与,春来花鸟莫深愁

花鸟风月将近一年没有回来,我觉得你肯定是似了,要不就是被董志民拐卖了,我哭死

我给你立了一个赛博大坟,请使用jupyterlab运行这段Python代码

import matplotlib.pyplot as plt
from PIL import Image, ImageDraw, ImageFont

def tablet(text, output_path="tablet.png"):
    width, height = 120, 160
    background_color = "#F5DEB3" 
    border_color = "#8B0000"
    text_color = "#000000"

    img = Image.new("RGB", (width, height), color=background_color)
    draw = ImageDraw.Draw(img)

    border_width = 6
    draw.rectangle(
        [(border_width, border_width), (width - border_width, height - border_width)],
        outline=border_color, width=border_width
    )

    draw.arc(
        [(border_width // 2, border_width // 2), (width - border_width // 2, height // 3)],
        start=0, end=180, fill=border_color, width=border_width // 2
    )

    font = ImageFont.load_default()
    lines = text.split("\n")
    y_offset = height // 3 
    for line in lines:
        draw.text((width // 2, y_offset), line, fill=text_color, font=font, anchor="mm", align="center")
        y_offset += 8

    img.save(output_path)
    print(f"Image saved to {output_path}")

tablet("故\n人\n花\n鸟\n风\n月\n之\n灵\n位", output_path="tablet.png")

img = Image.open("tablet.png")
plt.imshow(img)
plt.axis("off")
plt.show()

菜单
  1. 正邪  

    高技术力