“teks ke python png” Kode Jawaban

Gambar ke SMS Python

from PIL import Image
import pytesseract

image = 'PATH/TO/IMAGE'
text = pytesseract.image_to_string(Image.open(image), lang="eng")
print(text)

# Code From here: https://www.youtube.com/watch?v=kxHp5ng6Rgw
the hacker man

Gambar ke SMS Python

from os import closerange
from PIL import Image
import pytesseract as tess
tess.pytesseract.tessetact_cmd = r'give your PATH TO TESSETACT.EXE'

image = r'complete path to image file'
text = tess.image_to_string(Image.open(image), lang="eng")
print(text)
Alive Albatross

teks ke python png

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")
Relieved Rabbit

Jawaban yang mirip dengan “teks ke python png”

Pertanyaan yang mirip dengan “teks ke python png”

Lebih banyak jawaban terkait untuk “teks ke python png” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya