1
Q
PIL
A
答えて
4
標準的な方法はないようですが、いつでも実装できます。
考えられる解決策:
import Image
import ImageDraw
import ImageFont
def draw_underlined_text(draw, pos, text, font, **options):
twidth, theight = draw.textsize(text, font=font)
lx, ly = pos[0], pos[1] + theight
draw.text(pos, text, font=font, **options)
draw.line((lx, ly, lx + twidth, ly), **options)
im = Image.new('RGB', (400, 400), (255,)*3)
draw = ImageDraw.Draw(im)
font = ImageFont.truetype("arial.ttf", 50)
draw_underlined_text(draw, (50, 150), 'Hello PIL!', font, fill=0)
draw_underlined_text(draw, (50, 300), 'Test', font, fill=128)
im.show()
関連する問題
- 1. PIL -
- 2. PIL - JPG
- 3. のpythonとPIL
- 4. Python/PIL os.listdirパーミッションエラー
- 5. pip install PIL fail
- 6. PIL fromring error
- 7. Django ImageField validation&PIL
- 8. PILとTkinter、マルチウィンドウ
- 9. PIL Image ImportError
- 10. Python get image matrix PIL
- 11. PILは、透明性
- 12. PILのダウンロードWindowsバイナリ
- 13. PILイメージオブジェクトのPythonコピー
- 14. RGBAビットマップをPILでロード
- 15. Python PIL画像の再現
- 16. PIL GdkPixbufを変換する
- 17. Python windows 7 screenshot without PIL
- 18. PINAX&PIL Windows 7でのインストール
- 19. PILとpy2exeの問題
- 20. PIL画像モード "P" - > "RGBA"
- 21. PILのテキストを囲む
- 22. DICOM to TIFF逆LUT ... Python&PIL
- 23. パイソン、PIL、作物の問題
- 24. PythonのPILのJPEG画質
- 25. がどのようにPIL
- 26. easy_install PILが失敗する
- 27. PIL Draw.textと低解像度
- 28. PILのImageDrawモジュールの使用
- 29. PILで行列を書く
- 30. DjangoでPILイメージにhtml5キャンバスをロード