{"id":114942,"date":"2024-03-23T00:43:59","date_gmt":"2024-03-22T15:43:59","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/"},"modified":"2024-04-04T23:20:35","modified_gmt":"2024-04-04T14:20:35","slug":"python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/","title":{"rendered":"Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u753b\u50cf\u304b\u3089\u6587\u5b57\u3092\u6d88\u53bb\u3059\u308b\u306b\u306f\u3001Python\u306e\u753b\u50cf\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u30fcPIL\uff08Pillow\uff09\u3092\u4f7f\u3048\u3070\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002\u6b21\u306b\u7c21\u5358\u306a\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"hljs-keyword\">from<\/span> PIL <span class=\"hljs-keyword\">import<\/span> Image, ImageDraw\r\n\r\n<span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title function_\">erase_text<\/span>(<span class=\"hljs-params\">image_path, text_coordinates<\/span>):\r\n    <span class=\"hljs-comment\"># \u6253\u5f00\u56fe\u7247<\/span>\r\n    img = Image.<span class=\"hljs-built_in\">open<\/span>(image_path)\r\n    draw = ImageDraw.Draw(img)\r\n\r\n    <span class=\"hljs-comment\"># \u5728\u8981\u64e6\u9664\u7684\u6587\u5b57\u533a\u57df\u4e0a\u7ed8\u5236\u4e0e\u80cc\u666f\u989c\u8272\u76f8\u540c\u7684\u77e9\u5f62<\/span>\r\n    <span class=\"hljs-keyword\">for<\/span> coordinates <span class=\"hljs-keyword\">in<\/span> text_coordinates:\r\n        x1, y1, x2, y2 = coordinates\r\n        draw.rectangle((x1, y1, x2, y2), fill=<span class=\"hljs-string\">\"white\"<\/span>)\r\n\r\n    <span class=\"hljs-comment\"># \u4fdd\u5b58\u4fee\u6539\u540e\u7684\u56fe\u7247<\/span>\r\n    img.save(<span class=\"hljs-string\">\"erased_image.png\"<\/span>)\r\n\r\n<span class=\"hljs-comment\"># \u793a\u4f8b\u7528\u6cd5<\/span>\r\ntext_coordinates = [(<span class=\"hljs-number\">100<\/span>, <span class=\"hljs-number\">100<\/span>, <span class=\"hljs-number\">200<\/span>, <span class=\"hljs-number\">150<\/span>)]  <span class=\"hljs-comment\"># \u8981\u64e6\u9664\u7684\u6587\u5b57\u533a\u57df\u7684\u5750\u6807<\/span>\r\nerase_text(<span class=\"hljs-string\">\"example_image.png\"<\/span>, text_coordinates)\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3067\u306f\u3001\u6d88\u53bb\u3059\u308b\u6587\u5b57\u9818\u57df\u306e\u5ea7\u6a19\u3067\u3042\u308b`text_coordinates`\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u3001\u77e9\u5f62\u5ea7\u6a19\u3092\u4f7f\u7528\u3057\u3066\u4f8b\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001PIL \u30e9\u30a4\u30d6\u30e9\u30ea\u306e `ImageDraw` \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3066\u3001\u6307\u5b9a\u3057\u305f\u9818\u57df\u306b\u80cc\u666f\u8272\u3068\u540c\u3058\u77e9\u5f62\u3092\u63cf\u753b\u3059\u308b\u3053\u3068\u3067\u3001\u6587\u5b57\u3092\u6d88\u53bb\u3057\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001\u5909\u66f4\u3055\u308c\u305f\u753b\u50cf\u3092 `erased_image.png` \u3068\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<p>\u6587\u5b57\u306e\u307f\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5\u3067\u3059\u306e\u3067\u3001\u8907\u96d1\u306a\u80cc\u666f\u3084\u30c6\u30ad\u30b9\u30c8\u306e\u88c5\u98fe\u306f\u5bfe\u5fdc\u3067\u304d\u307e\u305b\u3093\u3053\u3068\u3001\u3054\u4e86\u627f\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u753b\u50cf\u304b\u3089\u6587\u5b57\u3092\u6d88\u53bb\u3059\u308b\u306b\u306f\u3001Python\u306e\u753b\u50cf\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u30fcPIL\uff08Pillow\uff09\u3092\u4f7f\u3048\u3070\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002\u6b21\u306b\u7c21\u5358\u306a\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u793a\u3057\u307e\u3059\u3002 from PIL import Image, ImageDraw def e [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-114942","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/python-\u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u753b\u50cf\u304b\u3089\u6587\u5b57\u3092\u6d88\u53bb\u3059\u308b\u306b\u306f\u3001Python\u306e\u753b\u50cf\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u30fcPIL\uff08Pillow\uff09\u3092\u4f7f\u3048\u3070\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002\u6b21\u306b\u7c21\u5358\u306a\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u793a\u3057\u307e\u3059\u3002 from PIL import Image, ImageDraw def e [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/python-\u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-22T15:43:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-04T14:20:35+00:00\" \/>\n<meta name=\"author\" content=\"\u967d, \u5411\u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u967d, \u5411\u5b87\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/\",\"name\":\"Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2024-03-22T15:43:59+00:00\",\"dateModified\":\"2024-04-04T14:20:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4aef6196128551a0f5d66db46c42866c\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4aef6196128551a0f5d66db46c42866c\",\"name\":\"\u967d, \u5411\u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ad96b120e219751fa368cbd7d2c48ca01b59185e6ed394449bac72614a760bf3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ad96b120e219751fa368cbd7d2c48ca01b59185e6ed394449bac72614a760bf3?s=96&d=mm&r=g\",\"caption\":\"\u967d, \u5411\u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/hinatasora\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/python-\u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5\/","og_locale":"ja_JP","og_type":"article","og_title":"Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5","og_description":"\u753b\u50cf\u304b\u3089\u6587\u5b57\u3092\u6d88\u53bb\u3059\u308b\u306b\u306f\u3001Python\u306e\u753b\u50cf\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u30fcPIL\uff08Pillow\uff09\u3092\u4f7f\u3048\u3070\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002\u6b21\u306b\u7c21\u5358\u306a\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u793a\u3057\u307e\u3059\u3002 from PIL import Image, ImageDraw def e [&hellip;]","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/python-\u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-03-22T15:43:59+00:00","article_modified_time":"2024-04-04T14:20:35+00:00","author":"\u967d, \u5411\u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u967d, \u5411\u5b87"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/","name":"Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2024-03-22T15:43:59+00:00","dateModified":"2024-04-04T14:20:35+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4aef6196128551a0f5d66db46c42866c"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Python \u3067\u753b\u50cf\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u6d88\u53bb\u3059\u308b\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4aef6196128551a0f5d66db46c42866c","name":"\u967d, \u5411\u5b87","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ad96b120e219751fa368cbd7d2c48ca01b59185e6ed394449bac72614a760bf3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ad96b120e219751fa368cbd7d2c48ca01b59185e6ed394449bac72614a760bf3?s=96&d=mm&r=g","caption":"\u967d, \u5411\u5b87"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/hinatasora\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python-%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%8b%e3%82%89%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%82%92%e6%b6%88%e5%8e%bb%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/114942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=114942"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/114942\/revisions"}],"predecessor-version":[{"id":297650,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/114942\/revisions\/297650"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=114942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=114942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=114942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}