by Anonymous » 28 Feb 2025, 05:47
Kurz gesagt, wie bekomme ich das:
def fiblike(ls, n):
store = []
for i in range(n):
a = ls.pop(0)
ls.append(sum(ls)+a)
store.append(a)
return store
< /code>
Mit all dem Eindrückungshandbuch und dem Code-Hervorhebung.
Code: Select all
import Image
import ImageDraw
import ImageFont
def getSize(txt, font):
testImg = Image.new('RGB', (1, 1))
testDraw = ImageDraw.Draw(testImg)
return testDraw.textsize(txt, font)
if __name__ == '__main__':
fontname = "Arial.ttf"
fontsize = 11
text = "[email protected]"
colorText = "black"
colorOutline = "red"
colorBackground = "white"
font = ImageFont.truetype(fontname, fontsize)
width, height = getSize(text, font)
img = Image.new('RGB', (width+4, height+4), colorBackground)
d = ImageDraw.Draw(img)
d.text((2, height/2), text, fill=colorText, font=font)
d.rectangle((0, 0, width+3, height+3), outline=colorOutline)
img.save("D:/image.png")
Von hier
wird jedoch kein Code -Hervorhebung durchgeführt und
ich möchte entweder eine Numme oder cv2 basierend>
Kurz gesagt, wie bekomme ich das:
def fiblike(ls, n):
store = []
for i in range(n):
a = ls.pop(0)
ls.append(sum(ls)+a)
store.append(a)
return store
< /code>
Mit all dem Eindrückungshandbuch und dem Code-Hervorhebung.[code]import Image
import ImageDraw
import ImageFont
def getSize(txt, font):
testImg = Image.new('RGB', (1, 1))
testDraw = ImageDraw.Draw(testImg)
return testDraw.textsize(txt, font)
if __name__ == '__main__':
fontname = "Arial.ttf"
fontsize = 11
text = "
[email protected]"
colorText = "black"
colorOutline = "red"
colorBackground = "white"
font = ImageFont.truetype(fontname, fontsize)
width, height = getSize(text, font)
img = Image.new('RGB', (width+4, height+4), colorBackground)
d = ImageDraw.Draw(img)
d.text((2, height/2), text, fill=colorText, font=font)
d.rectangle((0, 0, width+3, height+3), outline=colorOutline)
img.save("D:/image.png")
[/code]
Von hier
wird jedoch kein Code -Hervorhebung durchgeführt und [url=viewtopic.php?t=14917]ich möchte[/url] entweder eine Numme oder cv2 basierend>