{"id":2326,"date":"2022-12-21T21:06:31","date_gmt":"2022-12-21T12:06:31","guid":{"rendered":"https:\/\/lab4ict.com\/website\/?p=2326"},"modified":"2024-02-03T13:19:32","modified_gmt":"2024-02-03T04:19:32","slug":"python-pillow%e3%81%a7%e6%96%87%e5%ad%97%e5%85%a5%e3%82%8a%e3%81%ae%e7%94%bb%e5%83%8f%e3%82%92%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8b%ef%bc%81","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/website\/articles\/2326","title":{"rendered":"Python Pillow\u3067\u6587\u5b57\u5165\u308a\u306e\u753b\u50cf\u3092\u4f5c\u6210\u3059\u308b\uff01"},"content":{"rendered":"<p>Python Pillow\u3067\u6587\u5b57\u5165\u308a\u306e\u753b\u50cf\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<h2>Python\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>Python Pillow\u3067\u4f5c\u6210\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002\u4f5c\u3055\u308c\u305f\u753b\u50cf\u306f\u3001\u672c\u7a3f\u306e\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u306e\u753b\u50cf\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nfrom PIL import Image, ImageFont, ImageDraw\r\n\r\n# Image Size\r\niw=1024\r\nih=576\r\n\r\n# Background Color\r\nbgr=225\r\nbgg=130\r\nbgb=50\r\n\r\n# Text Color\r\ntxr=225\r\ntxg=225\r\ntxb=225\r\n\r\n# Text Attributes\r\ntext=&quot;Pillow&quot;\r\nsize=96\r\nfontfile=&quot;\/usr\/share\/fonts\/truetype\/takao-gothic\/TakaoGothic.ttf&quot;\r\n\r\n# Image Path\r\nsavefile=&quot;\/home\/usradmin\/doc\/images\/eyecatch_pillow_01.png&quot;\r\n\r\nimg=Image.new(&quot;RGB&quot;,(iw,ih),(bgr,bgg,bgb))\r\n\r\ndraw = ImageDraw.Draw(img)\r\nfont = ImageFont.truetype(fontfile,size)\r\n\r\ndraw.text((iw\/3+10,ih\/2-40), text ,(txr,txg,txb), font=font, anchor=&quot;mm&quot;)\r\n\r\nimg.save(savefile)\r\n<\/pre>\n<p>draw.text\u95a2\u6570\u306e\u5f15\u6570\u3067\u6307\u5b9a\u3059\u308b\u30c6\u30ad\u30b9\u30c8\u306e\u4f4d\u7f6e\u306f\u3001\u3064\u3069\u3064\u3069\u8abf\u6574\u304c\u5fc5\u8981\u3067\u3059\u3002\u3053\u306e\u3042\u305f\u308a\u3082\u3001\u81ea\u52d5\u5316\u3067\u304d\u308c\u3070\u3088\u3044\u306e\u3067\u3059\u304c\u30fb\u30fb\u30fb<\/p>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>Python Pillow\u3092\u4f7f\u3046\u3068\u304d\u308c\u3044\u306a\u753b\u50cf\u3092\u7c21\u5358\u306b\u81ea\u52d5\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u753b\u50cf\u30bd\u30d5\u30c8\u3092\u4f7f\u7528\u3057\u3066\u4f5c\u6210\u3059\u308b\u3088\u308a\u3001\u304b\u306a\u308a\u4f5c\u696d\u304c\u52b9\u7387\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Pillow\u3067\u6587\u5b57\u5165\u308a\u306e\u753b\u50cf\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 Python\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\uff01 Python Pillow\u3067\u4f5c\u6210\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002\u4f5c\u3055\u308c\u305f\u753b\u50cf\u306f\u3001\u672c\u7a3f\u306e\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u306e\u753b\u50cf\u3067\u3059\u3002 from PIL import\u2026<\/p>\n","protected":false},"author":1,"featured_media":2328,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-2326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-pillow"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/posts\/2326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/comments?post=2326"}],"version-history":[{"count":7,"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/posts\/2326\/revisions"}],"predecessor-version":[{"id":2335,"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/posts\/2326\/revisions\/2335"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/media\/2328"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/media?parent=2326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/categories?post=2326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/website\/wp-json\/wp\/v2\/tags?post=2326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}