{"id":553,"date":"2024-04-28T18:26:02","date_gmt":"2024-04-28T09:26:02","guid":{"rendered":"https:\/\/chocottopro.com\/?p=553"},"modified":"2024-04-28T18:26:03","modified_gmt":"2024-04-28T09:26:03","slug":"%e3%80%90%e5%ae%8c%e5%85%a8%e7%89%88%e3%80%91%e3%81%9f%e3%81%a3%e3%81%9f10%e3%82%b9%e3%83%86%e3%83%83%e3%83%97%ef%bc%81python%e3%81%aepillow%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%a7","status":"publish","type":"post","link":"https:\/\/chocottopro.com\/?p=553","title":{"rendered":"\u3010\u5b8c\u5168\u7248\u3011\u305f\u3063\u305f10\u30b9\u30c6\u30c3\u30d7\uff01Python\u306ePillow\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u753b\u50cf\u51e6\u7406\u3092\u30de\u30b9\u30bf\u30fc\u3057\u3088\u3046"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Python\u3067\u753b\u50cf\u51e6\u7406\u3092\u884c\u3046\u306a\u3089\u3001Pillow\u306f\u5916\u305b\u306a\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u521d\u5fc3\u8005\u3067\u3082\u4f7f\u3044\u3084\u3059\u3044API\u3068\u8c4a\u5bcc\u306a\u6a5f\u80fd\u3092\u517c\u306d\u5099\u3048\u305fPillow\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u306e\u8aad\u307f\u8fbc\u307f\u3084\u4fdd\u5b58\u3001\u30ea\u30b5\u30a4\u30ba\u3001\u30d5\u30a3\u30eb\u30bf\u30fc\u9069\u7528\u306a\u3069\u3001\u69d8\u3005\u306a\u51e6\u7406\u3092\u7c21\u5358\u306b\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001Pillow\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u304b\u3089\u5b9f\u8df5\u7684\u306a\u30c6\u30af\u30cb\u30c3\u30af\u307e\u3067\u3001\u30b9\u30c6\u30c3\u30d7\u30d0\u30a4\u30b9\u30c6\u30c3\u30d7\u3067\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-sgb-block-simple sgb-box-simple sgb-box-simple--title-normal sgb-box-simple--with-border\"><div style=\"background-color:var(--wp--preset--color--sango-main);color:#FFF\" class=\"sgb-box-simple__title\">\u3010\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3093\u3060\u3089\u308f\u304b\u308b\u3053\u3068\u3011<\/div><div class=\"sgb-box-simple__body\" style=\"border-color:var(--wp--preset--color--sango-main);background-color:#FFF\">\n<ul class=\"wp-block-list\">\n<li>Pillow\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u3068\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9 <\/li>\n\n\n\n<li>\u753b\u50cf\u306e\u8aad\u307f\u8fbc\u307f\u3001\u4fdd\u5b58\u3001\u30ea\u30b5\u30a4\u30ba\u3001\u30c8\u30ea\u30df\u30f3\u30b0\u306e\u65b9\u6cd5 <\/li>\n\n\n\n<li>\u753b\u50cf\u306e\u56de\u8ee2\u3001\u53cd\u8ee2\u3001\u30d5\u30a3\u30eb\u30bf\u30fc\u9069\u7528\u3001\u30a8\u30d5\u30a7\u30af\u30c8\u306e\u4ed8\u4e0e\u65b9\u6cd5 <\/li>\n\n\n\n<li>\u753b\u50cf\u306e\u4e00\u62ec\u51e6\u7406\u3084\u30d0\u30c3\u30c1\u51e6\u7406\u306e\u5b9f\u884c\u65b9\u6cd5 <\/li>\n\n\n\n<li>\u9854\u691c\u51fa\u3084\u9854\u8a8d\u8b58\u306a\u3069\u3001\u9ad8\u5ea6\u306a\u753b\u50cf\u51e6\u7406\u306e\u5b9f\u73fe\u65b9\u6cd5 <\/li>\n\n\n\n<li>Pillow\u3068\u6a5f\u68b0\u5b66\u7fd2\u306e\u9023\u643a\u65b9\u6cd5 <\/li>\n\n\n\n<li>Web\u30a2\u30d7\u30ea\u3084\u30b5\u30fc\u30d3\u30b9\u958b\u767a\u3067\u306ePillow\u306e\u6d3b\u7528\u65b9\u6cd5 <\/li>\n\n\n\n<li>\u3055\u3089\u306a\u308b\u753b\u50cf\u51e6\u7406\u30b9\u30ad\u30eb\u306e\u5411\u4e0a\u306b\u5411\u3051\u305f\u30d2\u30f3\u30c8<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"toc\"><br \/>\n<b>Warning<\/b>:  Undefined array key \"is_admin\" in <b>\/home\/c7479301\/public_html\/chocottopro.com\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>116<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_category_top\" in <b>\/home\/c7479301\/public_html\/chocottopro.com\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>121<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_top\" in <b>\/home\/c7479301\/public_html\/chocottopro.com\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>128<\/b><br \/>\n    <div id=\"toc_container\" class=\"sgb-toc--bullets js-smooth-scroll\" data-dialog-title=\"Table of Contents\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">Pillow\u3068\u306f\uff1fPython\u306e\u753b\u50cf\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u57fa\u790e\u77e5\u8b58<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">Pillow\u306e\u6982\u8981\u3068\u7279\u5fb4<\/a>      <\/li>      <li>        <a href=\"#i-2\">Pillow\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u74b0\u5883\u8a2d\u5b9a<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-3\">Pillow\u3067\u6271\u3048\u308b\u753b\u50cf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-4\">Pillow\u306b\u3088\u308b\u753b\u50cf\u306e\u8aad\u307f\u8fbc\u307f\u3068\u4fdd\u5b58<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-5\">\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u30aa\u30fc\u30d7\u30f3\u3068\u8868\u793a<\/a>      <\/li>      <li>        <a href=\"#i-6\">\u753b\u50cf\u306e\u65b0\u898f\u4f5c\u6210\u3068\u4fdd\u5b58<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-7\">\u753b\u50cf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u5909\u63db\u3068\u51fa\u529b<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-8\">Pillow\u3092\u4f7f\u3063\u305f\u57fa\u672c\u7684\u306a\u753b\u50cf\u51e6\u7406\u30c6\u30af\u30cb\u30c3\u30af<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-9\">\u753b\u50cf\u306e\u30ea\u30b5\u30a4\u30ba\u3068\u30c8\u30ea\u30df\u30f3\u30b0<\/a>      <\/li>      <li>        <a href=\"#i-10\">\u753b\u50cf\u306e\u56de\u8ee2\u3068\u53cd\u8ee2<\/a>      <\/li>      <li>        <a href=\"#i-11\">\u753b\u50cf\u306e\u660e\u308b\u3055\u30fb\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u8abf\u6574<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-12\">\u753b\u50cf\u3078\u306e\u30c6\u30ad\u30b9\u30c8\u63cf\u753b<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-13\">Pillow\u306b\u3088\u308b\u753b\u50cf\u30d5\u30a3\u30eb\u30bf\u30fc\u3068\u52b9\u679c\u306e\u9069\u7528<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-14\">\u307c\u304b\u3057\u30fb\u30b7\u30e3\u30fc\u30d7\u30fb\u30a8\u30f3\u30dc\u30b9\u7b49\u306e\u753b\u50cf\u30d5\u30a3\u30eb\u30bf\u30fc<\/a>      <\/li>      <li>        <a href=\"#i-15\">\u753b\u50cf\u306e\u4e8c\u5024\u5316\u3068\u6e1b\u8272\u51e6\u7406<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-16\">\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u3068\u900f\u660e\u5ea6\u306e\u64cd\u4f5c<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-17\">Pillow\u3092\u6d3b\u7528\u3057\u305f\u5b9f\u8df5\u7684\u306a\u753b\u50cf\u51e6\u7406<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-18\">\u753b\u50cf\u306e\u4e00\u62ec\u51e6\u7406\u3068\u30d0\u30c3\u30c1\u51e6\u7406<\/a>      <\/li>      <li>        <a href=\"#i-19\">\u753b\u50cf\u304b\u3089\u306e\u9854\u691c\u51fa\u3068\u9854\u8a8d\u8b58<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-20\">\u753b\u50cf\u306e\u30e2\u30b6\u30a4\u30af\u30fb\u307c\u304b\u3057\u51e6\u7406\u306b\u3088\u308b\u533f\u540d\u5316<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-21\">Pillow\u306e\u3055\u3089\u306a\u308b\u6d3b\u7528\u306b\u5411\u3051\u3066<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-22\">Pillow\u3068\u6a5f\u68b0\u5b66\u7fd2\u306e\u9023\u643a<\/a>      <\/li>      <li>        <a href=\"#i-23\">Pillow\u3092\u4f7f\u3063\u305fWeb\u30a2\u30d7\u30ea\u3084\u30b5\u30fc\u30d3\u30b9\u306e\u958b\u767a<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-24\">\u753b\u50cf\u51e6\u7406\u30b9\u30ad\u30eb\u306e\u3055\u3089\u306a\u308b\u5411\u4e0a\u306e\u305f\u3081\u306b<\/a>      <\/li>    <\/ul>  <\/li><\/ul>\n      \n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">Pillow\u3068\u306f\uff1fPython\u306e\u753b\u50cf\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u57fa\u790e\u77e5\u8b58<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u306f\u3001Python\u3067\u753b\u50cf\u51e6\u7406\u3092\u884c\u3046\u305f\u3081\u306e\u5f37\u529b\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u5143\u3005\u306fPIL\uff08Python Imaging Library\uff09\u3068\u3044\u3046\u540d\u524d\u3067\u3057\u305f\u304c\u3001Python3\u306b\u5bfe\u5fdc\u3059\u308b\u305f\u3081\u306b\u30d5\u30a9\u30fc\u30af\u3055\u308c\u3001\u73fe\u5728\u3067\u306fPillow\u3068\u3044\u3046\u540d\u524d\u3067\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-1\">Pillow\u306e\u6982\u8981\u3068\u7279\u5fb4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u306f\u3001\u30b7\u30f3\u30d7\u30eb\u3067\u4f7f\u3044\u3084\u3059\u3044API\u3092\u7279\u5fb4\u3068\u3057\u3066\u304a\u308a\u3001\u521d\u5fc3\u8005\u306b\u3082\u6271\u3044\u3084\u3059\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002JPEG\u3084PNG\u3001GIF\u3001BMP\u3001TIFF\u306a\u3069\u3001\u591a\u69d8\u306a\u753b\u50cf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\u753b\u50cf\u306e\u8aad\u307f\u8fbc\u307f\u3084\u4fdd\u5b58\u3001\u30ea\u30b5\u30a4\u30ba\u3001\u56de\u8ee2\u3001\u30d5\u30a3\u30eb\u30bf\u30fc\u9069\u7528\u306a\u3069\u3001\u8c4a\u5bcc\u306a\u753b\u50cf\u51e6\u7406\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u3066\u304a\u308a\u3001\u5e45\u5e83\u3044\u30cb\u30fc\u30ba\u306b\u5fdc\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">Pillow\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u74b0\u5883\u8a2d\u5b9a<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u975e\u5e38\u306b\u7c21\u5358\u3067\u3059\u3002Pillow\u306fPyPI\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306bpip\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pip install Pillow<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Anaconda\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">conda install Pillow<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7279\u5225\u306a\u74b0\u5883\u8a2d\u5b9a\u306f\u4e0d\u8981\u3067\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3060\u3051\u3067\u3059\u3050\u306bPillow\u3092\u4f7f\u3044\u59cb\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-3\">Pillow\u3067\u6271\u3048\u308b\u753b\u50cf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u306f\u591a\u5f69\u306a\u753b\u50cf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u4ee3\u8868\u7684\u306a\u3082\u306e\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>JPEG\uff1a\u4e00\u822c\u7684\u306a\u5199\u771f\u753b\u50cf\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3059\u3002<\/li>\n\n\n\n<li>PNG\uff1a\u53ef\u9006\u5727\u7e2e\u3068\u900f\u660e\u5ea6\u3092\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3001\u9ad8\u753b\u8cea\u306a\u753b\u50cf\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li>GIF\uff1a\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u753b\u50cf\u306b\u3082\u4f7f\u308f\u308c\u308b\u3001\u30b3\u30f3\u30d1\u30af\u30c8\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3059\u3002<\/li>\n\n\n\n<li>BMP\uff1aWindows\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u753b\u50cf\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u9020\u304c\u7279\u5fb4\u3067\u3059\u3002<\/li>\n\n\n\n<li>TIFF\uff1a\u9ad8\u753b\u8cea\u306a\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u6271\u3046\u305f\u3081\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u4ed6\u306b\u3082\u3001PPM\u3001PGM\u3001PBM\u306a\u3069\u3001\u69d8\u3005\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002Pillow\u3092\u4f7f\u3048\u3070\u3001\u3053\u308c\u3089\u306e\u753b\u50cf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u8aad\u307f\u8fbc\u3093\u3060\u308a\u3001\u5225\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5909\u63db\u3057\u305f\u308a\u3068\u3001\u67d4\u8edf\u306a\u753b\u50cf\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6b21\u7ae0\u3067\u306f\u3001Pillow\u3092\u4f7f\u3063\u305f\u57fa\u672c\u7684\u306a\u753b\u50cf\u51e6\u7406\u306e\u65b9\u6cd5\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-4\">Pillow\u306b\u3088\u308b\u753b\u50cf\u306e\u8aad\u307f\u8fbc\u307f\u3068\u4fdd\u5b58<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u3092\u4f7f\u3048\u3070\u3001\u69d8\u3005\u306a\u5f62\u5f0f\u306e\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u7c21\u5358\u306b\u8aad\u307f\u8fbc\u3093\u3060\u308a\u3001\u4fdd\u5b58\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u753b\u50cf\u306e\u8aad\u307f\u8fbc\u307f\u3068\u4fdd\u5b58\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5909\u63db\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-5\">\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u30aa\u30fc\u30d7\u30f3\u3068\u8868\u793a<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u3067\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\u306b\u306f\u3001<code>Image.open()<\/code>\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002\u5f15\u6570\u306b\u306f\u3001\u958b\u304d\u305f\u3044\u753b\u50cf\u306e\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u958b\u3044\u305f\u753b\u50cf\u306f<code>Image<\/code>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u6271\u308f\u308c\u3001\u753b\u50cf\u306e\u30b5\u30a4\u30ba\u3084\u8272\u6df1\u5ea6\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306a\u3069\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image\n\nimg = Image.open(\"sample.jpg\")\nprint(img.format, img.size, img.mode)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u3068\u3044\u3046\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304d\u3001\u753b\u50cf\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3001\u30b5\u30a4\u30ba\u3001\u30e2\u30fc\u30c9\uff08\u30ab\u30e9\u30fc\u30bf\u30a4\u30d7\uff09\u3092\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305f\u3001<code>Image<\/code>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e<code>show()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u3067\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d3\u30e5\u30fc\u30a2\u3067\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">img.show()<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-6\">\u753b\u50cf\u306e\u65b0\u898f\u4f5c\u6210\u3068\u4fdd\u5b58<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u3067\u306f\u3001<code>Image.new()<\/code>\u95a2\u6570\u3092\u4f7f\u3063\u3066\u65b0\u3057\u3044\u753b\u50cf\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u7b2c1\u5f15\u6570\u306b\u306f\u30e2\u30fc\u30c9\uff08\u30ab\u30e9\u30fc\u30bf\u30a4\u30d7\uff09\u3001\u7b2c2\u5f15\u6570\u306b\u306f\u30b5\u30a4\u30ba\uff08\u5e45, \u9ad8\u3055\uff09\u3001<code>color<\/code>\u5f15\u6570\u306b\u306f\u80cc\u666f\u8272\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image\n\nnew_img = Image.new(\"RGB\", (400, 300), color=(255, 255, 255))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001400\u00d7300\u30d4\u30af\u30bb\u30eb\u306eRGB\u753b\u50cf\u3092\u3001\u767d\u80cc\u666f\u3067\u65b0\u898f\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f5c\u6210\u3057\u305f\u753b\u50cf\u3084\u3001\u5909\u66f4\u3092\u52a0\u3048\u305f\u753b\u50cf\u3092\u4fdd\u5b58\u3059\u308b\u306b\u306f\u3001<code>Image<\/code>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e<code>save()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002\u7b2c1\u5f15\u6570\u306b\u306f\u4fdd\u5b58\u5148\u306e\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3001\u7b2c2\u5f15\u6570\u306b\u306f\u4fdd\u5b58\u5f62\u5f0f\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">new_img.save(\"new_image.png\", \"PNG\")<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u65b0\u898f\u4f5c\u6210\u3057\u305f\u753b\u50cf\u3092<code>new_image.png<\/code>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u3001PNG\u5f62\u5f0f\u3067\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-7\">\u753b\u50cf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u5909\u63db\u3068\u51fa\u529b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u3092\u4f7f\u3048\u3070\u3001\u8aad\u307f\u8fbc\u3093\u3060\u753b\u50cf\u3092\u5225\u306e\u5f62\u5f0f\u306b\u5909\u63db\u3057\u3066\u4fdd\u5b58\u3059\u308b\u3053\u3068\u3082\u7c21\u5358\u3067\u3059\u3002<code>Image<\/code>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e<code>convert()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u3001\u753b\u50cf\u306e\u30e2\u30fc\u30c9\uff08\u30ab\u30e9\u30fc\u30bf\u30a4\u30d7\uff09\u3092\u5909\u66f4\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image\n\nimg = Image.open(\"sample.jpg\")\nimg_png = img.convert(\"RGBA\")<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001JPEG\u3067\u8aad\u307f\u8fbc\u3093\u3060\u753b\u50cf\u3092\u3001RGBA\u30e2\u30fc\u30c9\u306b\u5909\u63db\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5909\u63db\u5f8c\u306e\u753b\u50cf\u3092\u4fdd\u5b58\u3059\u308b\u969b\u306f\u3001<code>save()<\/code>\u30e1\u30bd\u30c3\u30c9\u306e\u7b2c2\u5f15\u6570\u3067\u4fdd\u5b58\u5f62\u5f0f\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">img_png.save(\"converted_image.png\", \"PNG\")<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u3088\u3046\u306b\u3057\u3066\u3001JPEG\u3067\u8aad\u307f\u8fbc\u3093\u3060\u753b\u50cf\u3092PNG\u5f62\u5f0f\u3067\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Pillow\u3067\u306f\u3001\u4ed6\u306b\u3082TIFF\u3084BMP\u3001GIF\u306a\u3069\u69d8\u3005\u306a\u5f62\u5f0f\u3067\u306e\u4fdd\u5b58\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u306e\u3088\u3046\u306b\u3001Pillow\u3092\u4f7f\u3048\u3070\u753b\u50cf\u306e\u8aad\u307f\u8fbc\u307f\u3084\u4fdd\u5b58\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5909\u63db\u3092\u624b\u8efd\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b21\u7ae0\u3067\u306f\u3001Pillow\u3092\u4f7f\u3063\u305f\u3088\u308a\u5b9f\u8df5\u7684\u306a\u753b\u50cf\u51e6\u7406\u306e\u65b9\u6cd5\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-8\">Pillow\u3092\u4f7f\u3063\u305f\u57fa\u672c\u7684\u306a\u753b\u50cf\u51e6\u7406\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u306f\u3001\u753b\u50cf\u51e6\u7406\u306b\u5f79\u7acb\u3064\u69d8\u3005\u306a\u6a5f\u80fd\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u30ea\u30b5\u30a4\u30ba\u3084\u30c8\u30ea\u30df\u30f3\u30b0\u3001\u56de\u8ee2\u3001\u660e\u308b\u3055\u8abf\u6574\u3001\u30c6\u30ad\u30b9\u30c8\u63cf\u753b\u306a\u3069\u3001\u57fa\u672c\u7684\u306a\u753b\u50cf\u51e6\u7406\u30c6\u30af\u30cb\u30c3\u30af\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-9\">\u753b\u50cf\u306e\u30ea\u30b5\u30a4\u30ba\u3068\u30c8\u30ea\u30df\u30f3\u30b0<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u753b\u50cf\u306e\u30b5\u30a4\u30ba\u3092\u5909\u66f4\u3059\u308b\u306b\u306f\u3001<code>Image<\/code>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e<code>resize()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002\u65b0\u3057\u3044\u30b5\u30a4\u30ba\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u30a2\u30b9\u30da\u30af\u30c8\u6bd4\u3092\u7dad\u6301\u3057\u305f\u307e\u307e\u30ea\u30b5\u30a4\u30ba\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image\n\nimg = Image.open(\"sample.jpg\")\nresized_img = img.resize((400, 300))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u3092\u5e45400\u30d4\u30af\u30bb\u30eb\u3001\u9ad8\u3055300\u30d4\u30af\u30bb\u30eb\u306b\u30ea\u30b5\u30a4\u30ba\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305f\u3001<code>crop()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u306e\u4e00\u90e8\u3092\u5207\u308a\u629c\u304f\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u5207\u308a\u629c\u304f\u9818\u57df\u3092 (\u5de6\u4e0a\u306ex\u5ea7\u6a19, \u5de6\u4e0a\u306ey\u5ea7\u6a19, \u53f3\u4e0b\u306ex\u5ea7\u6a19, \u53f3\u4e0b\u306ey\u5ea7\u6a19) \u306e\u5f62\u5f0f\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cropped_img = img.crop((100, 100, 300, 300))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u306e (100, 100) \u304b\u3089 (300, 300) \u307e\u3067\u306e\u9818\u57df\u3092\u5207\u308a\u629c\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-10\">\u753b\u50cf\u306e\u56de\u8ee2\u3068\u53cd\u8ee2<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>rotate()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u3092\u6307\u5b9a\u3057\u305f\u89d2\u5ea6\u3060\u3051\u56de\u8ee2\u3067\u304d\u307e\u3059\u3002<code>expand<\/code>\u30aa\u30d7\u30b7\u30e7\u30f3\u3092<code>True<\/code>\u306b\u3059\u308b\u3068\u3001\u56de\u8ee2\u5f8c\u306e\u753b\u50cf\u304c\u5207\u308c\u306a\u3044\u3088\u3046\u3001\u30b5\u30a4\u30ba\u304c\u81ea\u52d5\u7684\u306b\u62e1\u5927\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image\n\nimg = Image.open(\"sample.jpg\")\nrotated_img = img.rotate(45, expand=True)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u309245\u5ea6\u56de\u8ee2\u3055\u305b\u3001\u30b5\u30a4\u30ba\u3092\u62e1\u5927\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305f\u3001<code>transpose()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u3092\u5782\u76f4\u65b9\u5411\u3084\u6c34\u5e73\u65b9\u5411\u306b\u53cd\u8ee2\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">flipped_img = img.transpose(Image.FLIP_LEFT_RIGHT)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u3092\u5de6\u53f3\u53cd\u8ee2\u3055\u305b\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-11\">\u753b\u50cf\u306e\u660e\u308b\u3055\u30fb\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u8abf\u6574<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ImageEnhance<\/code>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u306e\u660e\u308b\u3055\u3084\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u3092\u7c21\u5358\u306b\u8abf\u6574\u3067\u304d\u307e\u3059\u3002<code>Brightness<\/code>\u30af\u30e9\u30b9\u3084<code>Contrast<\/code>\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u3001<code>enhance()<\/code>\u30e1\u30bd\u30c3\u30c9\u3067\u8abf\u6574\u306e\u5ea6\u5408\u3044\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image, ImageEnhance\n\nimg = Image.open(\"sample.jpg\")\nenhancer = ImageEnhance.Brightness(img)\nbrighter_img = enhancer.enhance(1.5)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u306e\u660e\u308b\u3055\u30921.5\u500d\u306b\u5897\u3084\u3057\u3066\u3044\u307e\u3059\u3002\u540c\u69d8\u306b\u3001<code>Contrast<\/code>\u30af\u30e9\u30b9\u3092\u4f7f\u3048\u3070\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u3092\u8abf\u6574\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-12\">\u753b\u50cf\u3078\u306e\u30c6\u30ad\u30b9\u30c8\u63cf\u753b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ImageDraw<\/code>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u4e0a\u306b\u30c6\u30ad\u30b9\u30c8\u3092\u63cf\u753b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305a\u3001<code>Draw<\/code>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001<code>text()<\/code>\u30e1\u30bd\u30c3\u30c9\u3067\u30c6\u30ad\u30b9\u30c8\u3092\u63cf\u753b\u3057\u307e\u3059\u3002\u30d5\u30a9\u30f3\u30c8\u3092\u6307\u5b9a\u3059\u308b\u306b\u306f\u3001<code>ImageFont<\/code>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image, ImageDraw, ImageFont\n\nimg = Image.open(\"sample.jpg\")\ndraw = ImageDraw.Draw(img)\nfont = ImageFont.truetype(\"arial.ttf\", 24)\ndraw.text((50, 50), \"Hello, World!\", font=font, fill=(255, 255, 255))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u306e (50, 50) \u306e\u4f4d\u7f6e\u306b\u300124\u30dd\u30a4\u30f3\u30c8\u306eArial\u30d5\u30a9\u30f3\u30c8\u3067\u300cHello, World!\u300d\u3068\u767d\u8272\u3067\u63cf\u753b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u306e\u3088\u3046\u306b\u3001Pillow\u3092\u4f7f\u3048\u3070\u753b\u50cf\u306e\u30ea\u30b5\u30a4\u30ba\u3084\u30c8\u30ea\u30df\u30f3\u30b0\u3001\u56de\u8ee2\u3001\u660e\u308b\u3055\u8abf\u6574\u3001\u30c6\u30ad\u30b9\u30c8\u63cf\u753b\u306a\u3069\u3001\u69d8\u3005\u306a\u51e6\u7406\u3092\u624b\u8efd\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b21\u7ae0\u3067\u306f\u3001\u3055\u3089\u306b\u9ad8\u5ea6\u306a\u753b\u50cf\u51e6\u7406\u30c6\u30af\u30cb\u30c3\u30af\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-13\">Pillow\u306b\u3088\u308b\u753b\u50cf\u30d5\u30a3\u30eb\u30bf\u30fc\u3068\u52b9\u679c\u306e\u9069\u7528<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u306b\u306f\u3001\u753b\u50cf\u306b\u30d5\u30a3\u30eb\u30bf\u30fc\u3084\u7279\u6b8a\u52b9\u679c\u3092\u9069\u7528\u3059\u308b\u305f\u3081\u306e\u6a5f\u80fd\u304c\u8c4a\u5bcc\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u307c\u304b\u3057\u3084\u30b7\u30e3\u30fc\u30d7\u3001\u30a8\u30f3\u30dc\u30b9\u7b49\u306e\u753b\u50cf\u30d5\u30a3\u30eb\u30bf\u30fc\u3001\u4e8c\u5024\u5316\u3084\u6e1b\u8272\u51e6\u7406\u3001\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u4f7f\u3063\u305f\u900f\u660e\u5ea6\u306e\u64cd\u4f5c\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-14\">\u307c\u304b\u3057\u30fb\u30b7\u30e3\u30fc\u30d7\u30fb\u30a8\u30f3\u30dc\u30b9\u7b49\u306e\u753b\u50cf\u30d5\u30a3\u30eb\u30bf\u30fc<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ImageFilter<\/code>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u306b\u69d8\u3005\u306a\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u307c\u304b\u3057\u52b9\u679c\u3092\u4e0e\u3048\u308b\u306b\u306f<code>BLUR<\/code>\u3001<code>GaussianBlur<\/code>\u3001<code>BoxBlur<\/code>\u306a\u3069\u306e\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image, ImageFilter\n\nimg = Image.open(\"sample.jpg\")\nblurred_img = img.filter(ImageFilter.BLUR)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u306b<code>BLUR<\/code>\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u9069\u7528\u3057\u3001\u307c\u304b\u3057\u52b9\u679c\u3092\u4e0e\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305f\u3001\u30b7\u30e3\u30fc\u30d7\u52b9\u679c\u3092\u4e0e\u3048\u308b\u306b\u306f<code>SHARPEN<\/code>\u3084<code>UnsharpMask<\/code>\u306a\u3069\u306e\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sharpened_img = img.filter(ImageFilter.SHARPEN)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u30a8\u30f3\u30dc\u30b9\u52b9\u679c\u3092\u4e0e\u3048\u305f\u3044\u5834\u5408\u306f\u3001<code>EMBOSS<\/code>\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">embossed_img = img.filter(ImageFilter.EMBOSS)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u3088\u3046\u306b\u3001<code>ImageFilter<\/code>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3048\u3070\u3001\u7c21\u5358\u306b\u753b\u50cf\u306b\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-15\">\u753b\u50cf\u306e\u4e8c\u5024\u5316\u3068\u6e1b\u8272\u51e6\u7406<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u753b\u50cf\u3092\u30b0\u30ec\u30fc\u30b9\u30b1\u30fc\u30eb\u3084\u767d\u9ed2\uff08\u4e8c\u5024\uff09\u306b\u5909\u63db\u3059\u308b\u306b\u306f\u3001<code>convert()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002\u5f15\u6570\u306b\u306f\u3001\u5909\u63db\u5148\u306e\u30e2\u30fc\u30c9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image\n\nimg = Image.open(\"sample.jpg\")\ngrayscale_img = img.convert(\"L\")\nbw_img = img.convert(\"1\")<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u3092\u30b0\u30ec\u30fc\u30b9\u30b1\u30fc\u30eb\uff08<code>\"L\"<\/code>\uff09\u3068\u767d\u9ed2\uff08<code>\"1\"<\/code>\uff09\u306b\u5909\u63db\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305f\u3001<code>posterize()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u306e\u8272\u6570\u3092\u6e1b\u3089\u3059\u6e1b\u8272\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u5f15\u6570\u306b\u306f\u3001\u6e1b\u8272\u5f8c\u306e\u8272\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">posterized_img = img.posterize(4)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u306e\u8272\u6570\u30924\u8272\u306b\u6e1b\u3089\u3057\u3066\u3044\u307e\u3059\u3002\u6e1b\u8272\u51e6\u7406\u306f\u3001\u753b\u50cf\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u3092\u5c0f\u3055\u304f\u3057\u305f\u3044\u5834\u5408\u306a\u3069\u306b\u6709\u52b9\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-16\">\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u3068\u900f\u660e\u5ea6\u306e\u64cd\u4f5c<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u3067\u306f\u3001RGBA\u30e2\u30fc\u30c9\u306e\u753b\u50cf\u3092\u4f7f\u3063\u3066\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\uff08\u900f\u660e\u5ea6\uff09\u3092\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<code>putalpha()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u306b\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image\n\nimg = Image.open(\"sample.png\").convert(\"RGBA\")\ntransparent_img = Image.new(\"RGBA\", img.size, (255, 255, 255, 128))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.png<\/code>\u3092RGBA\u30e2\u30fc\u30c9\u306b\u5909\u63db\u3057\u3001\u534a\u900f\u660e\u306e\u767d\u8272\u306e\u753b\u50cf\u3092\u65b0\u898f\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305f\u3001<code>alpha_composite()<\/code>\u95a2\u6570\u3092\u4f7f\u3048\u3070\u30012\u3064\u306eRGBA\u753b\u50cf\u3092\u5408\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">composited_img = Image.alpha_composite(img, transparent_img)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.png<\/code>\u3068\u534a\u900f\u660e\u306e\u767d\u8272\u753b\u50cf\u3092\u5408\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u306b\u900f\u660e\u5ea6\u3092\u6301\u305f\u305b\u305f\u308a\u3001\u8907\u6570\u306e\u753b\u50cf\u3092\u91cd\u306d\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u306e\u3088\u3046\u306b\u3001Pillow\u3092\u4f7f\u3048\u3070\u753b\u50cf\u306b\u30d5\u30a3\u30eb\u30bf\u30fc\u3084\u52b9\u679c\u3092\u9069\u7528\u3057\u305f\u308a\u3001\u4e8c\u5024\u5316\u3084\u6e1b\u8272\u51e6\u7406\u3092\u884c\u3063\u305f\u308a\u3001\u30a2\u30eb\u30d5\u30a1\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u64cd\u4f5c\u3057\u305f\u308a\u3068\u3001\u591a\u69d8\u306a\u753b\u50cf\u51e6\u7406\u304c\u53ef\u80fd\u3067\u3059\u3002\u6b21\u7ae0\u3067\u306f\u3001\u3053\u308c\u3089\u306e\u6280\u8853\u3092\u5fdc\u7528\u3057\u305f\u5b9f\u8df5\u7684\u306a\u753b\u50cf\u51e6\u7406\u306e\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-17\">Pillow\u3092\u6d3b\u7528\u3057\u305f\u5b9f\u8df5\u7684\u306a\u753b\u50cf\u51e6\u7406<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u308c\u307e\u3067\u7d39\u4ecb\u3057\u3066\u304d\u305fPillow\u306e\u6a5f\u80fd\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u5b9f\u8df5\u7684\u306a\u753b\u50cf\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u753b\u50cf\u306e\u4e00\u62ec\u51e6\u7406\u3084\u30d0\u30c3\u30c1\u51e6\u7406\u3001\u9854\u691c\u51fa\u3068\u9854\u8a8d\u8b58\u3001\u30e2\u30b6\u30a4\u30af\u3084\u307c\u304b\u3057\u306b\u3088\u308b\u533f\u540d\u5316\u306a\u3069\u3001\u5b9f\u7528\u7684\u306a\u753b\u50cf\u51e6\u7406\u306e\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-18\">\u753b\u50cf\u306e\u4e00\u62ec\u51e6\u7406\u3068\u30d0\u30c3\u30c1\u51e6\u7406<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Python\u306e<code>os<\/code>\u30e2\u30b8\u30e5\u30fc\u30eb\u3084<code>glob<\/code>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3048\u3070\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u62ec\u3067\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>images<\/code>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306eJPEG\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u62ec\u3067\u30ea\u30b5\u30a4\u30ba\u3057\u3001<code>resized<\/code>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import os\nfrom PIL import Image\n\nfor file in os.listdir(\"images\"):\n    if file.endswith(\".jpg\"):\n        img = Image.open(os.path.join(\"images\", file))\n        img = img.resize((800, 600))\n        img.save(os.path.join(\"resized\", file))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u3088\u3046\u306b\u3001\u4e00\u62ec\u30ea\u30b5\u30a4\u30ba\u3084\u4e00\u62ec\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5909\u63db\u306a\u3069\u306e\u30d0\u30c3\u30c1\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u3067\u3001\u5927\u91cf\u306e\u753b\u50cf\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-19\">\u753b\u50cf\u304b\u3089\u306e\u9854\u691c\u51fa\u3068\u9854\u8a8d\u8b58<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>face_recognition<\/code>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u304b\u3089\u9854\u3092\u691c\u51fa\u3057\u305f\u308a\u3001\u9854\u3092\u8a8d\u8b58\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u304b\u3089\u9854\u3092\u691c\u51fa\u3057\u3001\u691c\u51fa\u3055\u308c\u305f\u9854\u306e\u4f4d\u7f6e\u3092\u4f7f\u3063\u3066\u9854\u753b\u50cf\u3092\u5207\u308a\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import face_recognition\nfrom PIL import Image, ImageDraw\n\nimg = Image.open(\"sample.jpg\")\nface_locations = face_recognition.face_locations(img)\n\nfor face_location in face_locations:\n    top, right, bottom, left = face_location\n    face_img = img.crop((left, top, right, bottom))\n    face_img.show()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3055\u3089\u306b\u3001<code>face_recognition<\/code>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u3066\u9854\u8a8d\u8b58\u3092\u884c\u3048\u3070\u3001\u753b\u50cf\u5185\u306e\u4eba\u7269\u3092\u7279\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u9854\u691c\u51fa\u3068\u9854\u8a8d\u8b58\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u69d8\u3005\u306a\u5fdc\u7528\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-20\">\u753b\u50cf\u306e\u30e2\u30b6\u30a4\u30af\u30fb\u307c\u304b\u3057\u51e6\u7406\u306b\u3088\u308b\u533f\u540d\u5316<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u30d7\u30e9\u30a4\u30d0\u30b7\u30fc\u4fdd\u8b77\u306e\u305f\u3081\u306b\u3001\u753b\u50cf\u5185\u306e\u9854\u3084\u500b\u4eba\u60c5\u5831\u306a\u3069\u3092\u533f\u540d\u5316\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002Pillow\u3092\u4f7f\u3048\u3070\u3001\u7279\u5b9a\u306e\u9818\u57df\u306b\u30e2\u30b6\u30a4\u30af\u3084\u307c\u304b\u3057\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u7c21\u5358\u306b\u533f\u540d\u5316\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>sample.jpg<\/code>\u306e\u7279\u5b9a\u306e\u9818\u57df\u306b\u30e2\u30b6\u30a4\u30af\u51e6\u7406\u3092\u9069\u7528\u3057\u3066\u3044\u307e\u3059\u3002<code>resize()<\/code>\u30e1\u30bd\u30c3\u30c9\u3067\u753b\u50cf\u3092\u7e2e\u5c0f\u3057\u3001\u518d\u5ea6\u62e1\u5927\u3059\u308b\u3053\u3068\u3067\u30e2\u30b6\u30a4\u30af\u52b9\u679c\u3092\u5b9f\u73fe\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image, ImageFilter\n\nimg = Image.open(\"sample.jpg\")\nface_locations = [(100, 100, 200, 200), (300, 300, 400, 400)]\n\nfor face_location in face_locations:\n    left, top, right, bottom = face_location\n    face_img = img.crop((left, top, right, bottom))\n    face_img = face_img.resize((10, 10), Image.NEAREST).resize((right-left, bottom-top), Image.NEAREST)\n    img.paste(face_img, (left, top, right, bottom))\n\nimg.show()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305f\u3001<code>ImageFilter<\/code>\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u307c\u304b\u3057\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u4f7f\u3048\u3070\u3001\u7279\u5b9a\u306e\u9818\u57df\u3092\u307c\u304b\u3059\u3053\u3068\u3067\u533f\u540d\u5316\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u306e\u3088\u3046\u306b\u3001Pillow\u3092\u4f7f\u3048\u3070\u753b\u50cf\u306e\u4e00\u62ec\u51e6\u7406\u3084\u30d0\u30c3\u30c1\u51e6\u7406\u3001\u9854\u691c\u51fa\u3068\u9854\u8a8d\u8b58\u3001\u533f\u540d\u5316\u51e6\u7406\u306a\u3069\u3001\u5b9f\u8df5\u7684\u306a\u753b\u50cf\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b21\u7ae0\u3067\u306f\u3001\u3055\u3089\u306bPillow\u3092\u6d3b\u7528\u3059\u308b\u305f\u3081\u306e\u30d2\u30f3\u30c8\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-21\">Pillow\u306e\u3055\u3089\u306a\u308b\u6d3b\u7528\u306b\u5411\u3051\u3066<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u3053\u307e\u3067Pillow\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u304b\u3089\u5b9f\u8df5\u7684\u306a\u753b\u50cf\u51e6\u7406\u307e\u3067\u898b\u3066\u304d\u307e\u3057\u305f\u304c\u3001Pillow\u306e\u6d3b\u7528\u306f\u3053\u308c\u3060\u3051\u306b\u3068\u3069\u307e\u308a\u307e\u305b\u3093\u3002\u3053\u3053\u3067\u306f\u3001Pillow\u3092\u3055\u3089\u306b\u6d3b\u7528\u3059\u308b\u305f\u3081\u306e\u30d2\u30f3\u30c8\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-22\">Pillow\u3068\u6a5f\u68b0\u5b66\u7fd2\u306e\u9023\u643a<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u3067\u524d\u51e6\u7406\u3057\u305f\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u306e\u5165\u529b\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u753b\u50cf\u8a8d\u8b58\u3084\u7269\u4f53\u691c\u51fa\u306a\u3069\u306e\u9ad8\u5ea6\u306a\u753b\u50cf\u51e6\u7406\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001Pillow\u3067\u753b\u50cf\u306e\u30ea\u30b5\u30a4\u30ba\u3084\u30c7\u30fc\u30bf\u62e1\u5f35\u3092\u884c\u3044\u3001Keras\u306a\u3069\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u69cb\u7bc9\u30fb\u5b66\u7fd2\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from PIL import Image\nfrom tensorflow.keras.preprocessing.image import img_to_array\nfrom tensorflow.keras.models import load_model\n\nimg = Image.open(\"sample.jpg\")\nimg = img.resize((224, 224))\nimg_array = img_to_array(img) \/ 255.0\nimg_array = img_array.reshape((1,) + img_array.shape)\n\nmodel = load_model(\"model.h5\")\nprediction = model.predict(img_array)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001Pillow\u3067\u753b\u50cf\u3092\u8aad\u307f\u8fbc\u3093\u3067\u30ea\u30b5\u30a4\u30ba\u3057\u3001Keras\u306e<code>img_to_array<\/code>\u95a2\u6570\u3067\u914d\u5217\u306b\u5909\u63db\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u5b66\u7fd2\u6e08\u307f\u306e\u30e2\u30c7\u30eb\u3092\u4f7f\u3063\u3066\u753b\u50cf\u306e\u4e88\u6e2c\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306b\u3001Pillow\u3068\u6a5f\u68b0\u5b66\u7fd2\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u9023\u643a\u3055\u305b\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u9ad8\u5ea6\u306a\u753b\u50cf\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-23\">Pillow\u3092\u4f7f\u3063\u305fWeb\u30a2\u30d7\u30ea\u3084\u30b5\u30fc\u30d3\u30b9\u306e\u958b\u767a<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u306f\u3001Web\u30a2\u30d7\u30ea\u3084\u30b5\u30fc\u30d3\u30b9\u306e\u958b\u767a\u3067\u3082\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001Django\u306a\u3069\u306eWeb\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u753b\u50cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3084\u30b5\u30e0\u30cd\u30a4\u30eb\u751f\u6210\u306a\u3069\u306e\u6a5f\u80fd\u3092\u6301\u3063\u305f\u30b5\u30fc\u30d3\u30b9\u3092\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from io import BytesIO\nfrom PIL import Image\nfrom django.core.files.base import ContentFile\nfrom .models import Photo\n\ndef save_photo(request):\n    uploaded_file = request.FILES['file']\n    img = Image.open(uploaded_file)\n    img = img.resize((800, 600))\n\n    thumb_io = BytesIO()\n    img.save(thumb_io, format='JPEG')\n\n    photo = Photo()\n    photo.image.save(uploaded_file.name, ContentFile(thumb_io.getvalue()), save=False)\n    photo.save()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u306f\u3001Django\u3067\u306e\u753b\u50cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u51e6\u7406\u306e\u4e00\u4f8b\u3067\u3059\u3002Pillow\u3092\u4f7f\u3063\u3066\u3001\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u305f\u753b\u50cf\u3092\u30ea\u30b5\u30a4\u30ba\u3057\u3001\u30b5\u30e0\u30cd\u30a4\u30eb\u3092\u751f\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u307e\u305f\u3001AWS\u306eLambda\u306a\u3069\u306e\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u74b0\u5883\u3067Pillow\u3092\u4f7f\u3063\u3066\u753b\u50cf\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-24\">\u753b\u50cf\u51e6\u7406\u30b9\u30ad\u30eb\u306e\u3055\u3089\u306a\u308b\u5411\u4e0a\u306e\u305f\u3081\u306b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u306f\u975e\u5e38\u306b\u4fbf\u5229\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u304c\u3001\u753b\u50cf\u51e6\u7406\u306e\u4e16\u754c\u306fPillow\u3060\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002OpenCV\u3084Scikit-image\u306a\u3069\u3001\u4ed6\u306e\u753b\u50cf\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3082\u89e6\u308c\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u6df1\u3044\u7406\u89e3\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u753b\u50cf\u51e6\u7406\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u4ed5\u7d44\u307f\u3092\u5b66\u3076\u3053\u3068\u3067\u3001\u81ea\u5206\u3067\u9ad8\u5ea6\u306a\u51e6\u7406\u3092\u5b9f\u88c5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u753b\u50cf\u51e6\u7406\u306e\u6700\u65b0\u306e\u7814\u7a76\u52d5\u5411\u3092\u30ad\u30e3\u30c3\u30c1\u30a2\u30c3\u30d7\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u8ad6\u6587\u3084\u66f8\u7c4d\u3092\u8aad\u3080\u3053\u3068\u3082\u91cd\u8981\u3067\u3059\u3002\u3055\u3089\u306b\u3001Kaggle\u306a\u3069\u306e\u30c7\u30fc\u30bf\u5206\u6790\u30b3\u30f3\u30da\u30c6\u30a3\u30b7\u30e7\u30f3\u306b\u53c2\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u5b9f\u8df5\u7684\u306a\u30b9\u30ad\u30eb\u3092\u78e8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pillow\u3092\u8d77\u70b9\u3068\u3057\u3066\u3001\u753b\u50cf\u51e6\u7406\u306e\u5965\u6df1\u3044\u4e16\u754c\u306b\u98db\u3073\u8fbc\u3093\u3067\u307f\u307e\u305b\u3093\u304b\u3002\u304d\u3063\u3068\u65b0\u305f\u306a\u767a\u898b\u3068\u3001\u3055\u3089\u306a\u308b\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u304c\u5f85\u3063\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u3067\u753b\u50cf\u51e6\u7406\u3092\u884c\u3046\u306a\u3089\u3001Pillow\u306f\u5916\u305b\u306a\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u521d\u5fc3\u8005\u3067\u3082\u4f7f\u3044\u3084\u3059\u3044API\u3068\u8c4a\u5bcc\u306a\u6a5f\u80fd\u3092\u517c\u306d\u5099\u3048\u305fPillow\u3092\u4f7f\u3048\u3070\u3001\u753b\u50cf\u306e\u8aad\u307f\u8fbc\u307f\u3084\u4fdd\u5b58\u3001\u30ea\u30b5\u30a4\u30ba\u3001\u30d5\u30a3\u30eb\u30bf\u30fc\u9069\u7528\u306a\u3069\u3001\u69d8\u3005\u306a\u51e6\u7406\u3092\u7c21\u5358\u306b\u5b9f\u88c5\u3067 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":554,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-553","post","type-post","status-publish","format-standard","has-post-thumbnail","category-python"],"_links":{"self":[{"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/posts\/553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=553"}],"version-history":[{"count":1,"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/posts\/553\/revisions"}],"predecessor-version":[{"id":555,"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/posts\/553\/revisions\/555"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/media\/554"}],"wp:attachment":[{"href":"https:\/\/chocottopro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}