반응형 Imagedraw2 AttributeError: 'ImageDraw' object has no attribute 'textsize' AttributeError: 'ImageDraw' object has no attribute 'textsize'¶ pil에 ImageDraww.Draw로 생성된 객체의 textsize 메서드를 사용할때 생기는 오류입니다. ImageFont.truetype로 생성된 객체에 getbbox 함수를 사용하여 오류를 해결할 수 있습니다. In [1]: from PIL import Image, ImageDraw, ImageFont # Banner settings banner_width = 1024 banner_height = 256 background_color = (255, 204, 0) # Bright yellow background text = "2024년 축 당선" text_color = (0, 0, 0) .. 2024. 3. 29. python show image with polygon, 파이썬 이미지 폴리곤하고 같이 그리기 python show image with polygon, 파이썬 이미지 폴리곤하고 같이 그리기 pillow와 matplotlb을 이용하여 그림위에 폴리곤을 그리는 방법은 아래 코드와 같습니다. from PIL import Image, ImageDraw import matplotlib.pyplot as plt # Open the image image = Image.open('image.jpg') # Create a new image with the same size as the original image poly_image = Image.new('RGBA', image.size, (0, 0, 0, 0)) # Draw the polygon on the new image draw = ImageDraw.Draw.. 2023. 4. 7. 이전 1 다음 반응형