{"id":1018727,"date":"2024-12-27T12:45:30","date_gmt":"2024-12-27T04:45:30","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1018727.html"},"modified":"2024-12-27T12:45:32","modified_gmt":"2024-12-27T04:45:32","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e6%97%8b%e8%bd%ac%e5%9b%be%e7%89%87","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1018727.html","title":{"rendered":"\u5982\u4f55\u7528python\u65cb\u8f6c\u56fe\u7247"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25161348\/681332ba-4cc9-4192-935f-21578f3253ea.webp\" alt=\"\u5982\u4f55\u7528python\u65cb\u8f6c\u56fe\u7247\" \/><\/p>\n<p><p> \u8981\u5728Python\u4e2d\u65cb\u8f6c\u56fe\u7247\uff0c\u53ef\u4ee5\u4f7f\u7528<strong>Python Imaging Library (PIL)<\/strong> \u6216\u8005\u662f\u5176\u5206\u652f <strong>Pillow<\/strong>\u3002<strong>Pillow<\/strong> \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u4e14\u6613\u4e8e\u4f7f\u7528\u7684\u56fe\u50cf\u5904\u7406\u5e93\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5b9e\u73b0\u56fe\u50cf\u7684\u65cb\u8f6c\u3001\u8c03\u6574\u5927\u5c0f\u3001\u88c1\u526a\u7b49\u64cd\u4f5c\u3002<strong>\u8981\u7528Python\u65cb\u8f6c\u56fe\u7247\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528Pillow\u5e93\u3001\u901a\u8fc7Image\u6a21\u5757\u52a0\u8f7d\u56fe\u7247\u3001\u8c03\u7528rotate\u51fd\u6570\u65cb\u8f6c\u56fe\u50cf<\/strong>\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Pillow\u5e93\u6765\u65cb\u8f6c\u56fe\u7247\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5b89\u88c5Pillow\u5e93<\/p>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u5904\u7406\u56fe\u50cf\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Pillow\u5e93\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install Pillow<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Pillow\u5e93\u662fPython\u4e2d\u5e38\u7528\u7684\u56fe\u50cf\u5904\u7406\u5e93\uff0c\u652f\u6301\u591a\u79cd\u56fe\u50cf\u683c\u5f0f\uff0c\u529f\u80fd\u5168\u9762\u4e14\u6613\u4e8e\u4f7f\u7528\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5373\u53ef\u4f7f\u7528\u8be5\u5e93\u8fdb\u884c\u5404\u79cd\u56fe\u50cf\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u52a0\u8f7d\u56fe\u50cf<\/p>\n<\/p>\n<p><p>\u4f7f\u7528Pillow\u5e93\u52a0\u8f7d\u56fe\u7247\u7684\u7b2c\u4e00\u6b65\u662f\u5bfc\u5165Image\u6a21\u5757\u5e76\u6253\u5f00\u76ee\u6807\u56fe\u50cf\u6587\u4ef6\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6765\u5b9e\u73b0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from PIL import Image<\/p>\n<h2><strong>\u6253\u5f00\u56fe\u50cf\u6587\u4ef6<\/strong><\/h2>\n<p>image = Image.open(&#39;your_image.jpg&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8c03\u7528<code>Image.open()<\/code>\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6253\u5f00\u6307\u5b9a\u8def\u5f84\u7684\u56fe\u50cf\u6587\u4ef6\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2aImage\u5bf9\u8c61\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8def\u5f84\u8981\u6b63\u786e\uff0c\u5e76\u4e14\u6587\u4ef6\u683c\u5f0f\u8981\u88abPillow\u5e93\u652f\u6301\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u65cb\u8f6c\u56fe\u50cf<\/p>\n<\/p>\n<p><p>\u5728Pillow\u4e2d\uff0c\u65cb\u8f6c\u56fe\u50cf\u975e\u5e38\u7b80\u5355\uff0c\u53ef\u4ee5\u4f7f\u7528Image\u5bf9\u8c61\u7684<code>rotate()<\/code>\u65b9\u6cd5\u3002<code>rotate()<\/code>\u65b9\u6cd5\u63a5\u6536\u65cb\u8f6c\u89d2\u5ea6\uff08\u4ee5\u5ea6\u4e3a\u5355\u4f4d\uff09\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u65cb\u8f6c\u540e\u7684Image\u5bf9\u8c61\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u65cb\u8f6c\u56fe\u50cf90\u5ea6<\/p>\n<p>rotated_image = image.rotate(90)<\/p>\n<h2><strong>\u663e\u793a\u65cb\u8f6c\u540e\u7684\u56fe\u50cf<\/strong><\/h2>\n<p>rotated_image.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u9762\u7684\u4ee3\u7801\u5c06\u539f\u59cb\u56fe\u50cf\u987a\u65f6\u9488\u65cb\u8f6c90\u5ea6\u3002<code>rotate()<\/code>\u65b9\u6cd5\u9ed8\u8ba4\u662f\u9006\u65f6\u9488\u65cb\u8f6c\uff0c\u5982\u679c\u9700\u8981\u987a\u65f6\u9488\u65cb\u8f6c90\u5ea6\uff0c\u53ef\u4ee5\u4f20\u5165-90\u5ea6\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u4fdd\u5b58\u65cb\u8f6c\u540e\u7684\u56fe\u50cf<\/p>\n<\/p>\n<p><p>\u5b8c\u6210\u56fe\u50cf\u7684\u65cb\u8f6c\u540e\uff0c\u53ef\u4ee5\u5c06\u65cb\u8f6c\u540e\u7684\u56fe\u50cf\u4fdd\u5b58\u5230\u78c1\u76d8\u3002\u4f7f\u7528<code>save()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u5c06Image\u5bf9\u8c61\u4fdd\u5b58\u4e3a\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u4fdd\u5b58\u65cb\u8f6c\u540e\u7684\u56fe\u50cf<\/p>\n<p>rotated_image.save(&#39;rotated_image.jpg&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>save()<\/code>\u65b9\u6cd5\u652f\u6301\u591a\u79cd\u683c\u5f0f\u7684\u56fe\u50cf\u8f93\u51fa\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u4e0d\u540c\u7684\u6587\u4ef6\u683c\u5f0f\u8fdb\u884c\u4fdd\u5b58\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u5b9e\u73b0\u4efb\u610f\u89d2\u5ea6\u65cb\u8f6c<\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u65cb\u8f6c\u56fe\u7247\u5230\u4efb\u610f\u7684\u89d2\u5ea6\u3002\u4f7f\u7528Pillow\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code>rotate()<\/code>\u65b9\u6cd5\u7684<code>expand<\/code>\u53c2\u6570\u6765\u5b9e\u73b0\uff0c\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u56fe\u7247\u4e0d\u4f1a\u56e0\u4e3a\u65cb\u8f6c\u800c\u88c1\u526a\u6389\u4e00\u90e8\u5206\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u65cb\u8f6c\u56fe\u50cf45\u5ea6\uff0c\u786e\u4fdd\u56fe\u50cf\u4e0d\u88ab\u88c1\u526a<\/p>\n<p>rotated_image = image.rotate(45, expand=True)<\/p>\n<h2><strong>\u663e\u793a\u65cb\u8f6c\u540e\u7684\u56fe\u50cf<\/strong><\/h2>\n<p>rotated_image.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8bbe\u7f6e<code>expand=True<\/code>\u53ef\u4ee5\u4fdd\u8bc1\u5728\u65cb\u8f6c\u8fc7\u7a0b\u4e2d\uff0c\u56fe\u50cf\u7684\u5c3a\u5bf8\u4f1a\u8c03\u6574\uff0c\u4ee5\u4fbf\u9002\u5e94\u65cb\u8f6c\u540e\u7684\u5c3a\u5bf8\u3002<\/p>\n<\/p>\n<p><p>\u516d\u3001\u5904\u7406\u900f\u660e\u80cc\u666f<\/p>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u7684\u56fe\u7247\u6709\u900f\u660e\u80cc\u666f\uff08\u5982PNG\u683c\u5f0f\uff09\uff0c\u65cb\u8f6c\u540e\u53ef\u80fd\u4f1a\u5931\u53bb\u900f\u660e\u6548\u679c\u3002\u4e3a\u4e86\u4fdd\u6301\u900f\u660e\u80cc\u666f\uff0c\u53ef\u4ee5\u5728\u65cb\u8f6c\u524d\u521b\u5efa\u4e00\u4e2a\u80cc\u666f\u900f\u660e\u7684\u56fe\u50cf\uff0c\u5e76\u5c06\u5176\u4e0e\u65cb\u8f6c\u540e\u7684\u56fe\u50cf\u5408\u5e76\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u6253\u5f00\u4e00\u4e2a\u5e26\u900f\u660e\u80cc\u666f\u7684\u56fe\u50cf<\/p>\n<p>image = Image.open(&#39;transparent_image.png&#39;)<\/p>\n<h2><strong>\u65cb\u8f6c\u56fe\u50cf<\/strong><\/h2>\n<p>rotated_image = image.rotate(45, expand=True)<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u80cc\u666f\u900f\u660e\u7684\u56fe\u50cf<\/strong><\/h2>\n<p>transparent_background = Image.new(&#39;RGBA&#39;, rotated_image.size, (255, 255, 255, 0))<\/p>\n<h2><strong>\u5c06\u65cb\u8f6c\u540e\u7684\u56fe\u50cf\u7c98\u8d34\u5230\u80cc\u666f\u56fe\u50cf\u4e0a<\/strong><\/h2>\n<p>transparent_background.paste(rotated_image, (0, 0), rotated_image)<\/p>\n<h2><strong>\u4fdd\u5b58\u5e26\u6709\u900f\u660e\u80cc\u666f\u7684\u65cb\u8f6c\u56fe\u50cf<\/strong><\/h2>\n<p>transparent_background.save(&#39;rotated_transparent_image.png&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528<code>Image.new()<\/code>\u65b9\u6cd5\u521b\u5efa\u4e00\u4e2a\u80cc\u666f\u900f\u660e\u7684\u56fe\u50cf\uff0c\u5e76\u4f7f\u7528<code>paste()<\/code>\u65b9\u6cd5\u5c06\u65cb\u8f6c\u540e\u7684\u56fe\u50cf\u7c98\u8d34\u5230\u80cc\u666f\u56fe\u50cf\u4e0a\uff0c\u8fd9\u6837\u53ef\u4ee5\u4fdd\u6301\u900f\u660e\u6548\u679c\u3002<\/p>\n<\/p>\n<p><p>\u4e03\u3001\u6279\u91cf\u65cb\u8f6c\u56fe\u7247<\/p>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u6279\u91cf\u5904\u7406\u56fe\u7247\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u7684os\u6a21\u5757\u904d\u5386\u76ee\u5f55\u4e2d\u7684\u56fe\u7247\u6587\u4ef6\uff0c\u5e76\u5bf9\u6bcf\u4e2a\u6587\u4ef6\u8fdb\u884c\u65cb\u8f6c\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>from PIL import Image<\/p>\n<h2><strong>\u56fe\u50cf\u6587\u4ef6\u5939\u8def\u5f84<\/strong><\/h2>\n<p>image_folder = &#39;images_folder&#39;<\/p>\n<h2><strong>\u904d\u5386\u6587\u4ef6\u5939\u4e2d\u7684\u6240\u6709\u56fe\u50cf\u6587\u4ef6<\/strong><\/h2>\n<p>for filename in os.listdir(image_folder):<\/p>\n<p>    if filename.endswith(&#39;.jpg&#39;) or filename.endswith(&#39;.png&#39;):<\/p>\n<p>        # \u6253\u5f00\u56fe\u50cf\u6587\u4ef6<\/p>\n<p>        image_path = os.path.join(image_folder, filename)<\/p>\n<p>        image = Image.open(image_path)<\/p>\n<p>        # \u65cb\u8f6c\u56fe\u50cf<\/p>\n<p>        rotated_image = image.rotate(90)<\/p>\n<p>        # \u4fdd\u5b58\u65cb\u8f6c\u540e\u7684\u56fe\u50cf<\/p>\n<p>        rotated_image.save(os.path.join(image_folder, &#39;rotated_&#39; + filename))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4f7f\u7528os\u6a21\u5757\u7684<code>listdir()<\/code>\u65b9\u6cd5\uff0c\u53ef\u4ee5\u83b7\u53d6\u6587\u4ef6\u5939\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\uff0c\u5e76\u5224\u65ad\u6587\u4ef6\u6269\u5c55\u540d\u6765\u8bc6\u522b\u56fe\u50cf\u6587\u4ef6\u3002\u5bf9\u6bcf\u4e2a\u56fe\u50cf\u6587\u4ef6\u8fdb\u884c\u65cb\u8f6c\u64cd\u4f5c\u540e\uff0c\u53ef\u4ee5\u4fdd\u5b58\u7ed3\u679c\u5230\u76f8\u540c\u76ee\u5f55\u4e0b\u3002<\/p>\n<\/p>\n<p><p>\u516b\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u548cPillow\u5e93\u8f7b\u677e\u5b9e\u73b0\u56fe\u50cf\u7684\u65cb\u8f6c\u64cd\u4f5c\u3002<strong>Pillow\u5e93\u529f\u80fd\u5f3a\u5927\uff0c\u4e0d\u4ec5\u652f\u6301\u65cb\u8f6c\u64cd\u4f5c\uff0c\u8fd8\u652f\u6301\u5176\u4ed6\u591a\u79cd\u56fe\u50cf\u5904\u7406\u4efb\u52a1<\/strong>\uff0c\u5982\u88c1\u526a\u3001\u8c03\u6574\u5927\u5c0f\u3001\u6ee4\u955c\u6548\u679c\u7b49\u3002\u901a\u8fc7\u7075\u6d3b\u4f7f\u7528\u8fd9\u4e9b\u529f\u80fd\uff0c\u53ef\u4ee5\u5b8c\u6210\u56fe\u50cf\u7684\u5404\u79cd\u5904\u7406\u9700\u6c42\u3002\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u6ce8\u610f\u9009\u62e9\u5408\u9002\u7684\u53c2\u6570\u548c\u65b9\u6cd5\uff0c\u4ee5\u4fbf\u5728\u4fdd\u6301\u56fe\u50cf\u8d28\u91cf\u7684\u540c\u65f6\u5b9e\u73b0\u6240\u9700\u7684\u6548\u679c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u65cb\u8f6c\u56fe\u7247\uff0c\u5177\u4f53\u6b65\u9aa4\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u8981\u7528Python\u65cb\u8f6c\u56fe\u7247\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528PIL\u5e93\uff08Pillow\u7684\u4e00\u4e2a\u5206\u652f\uff09\uff0c\u5b83\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u56fe\u50cf\u5904\u7406\u529f\u80fd\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88c5Pillow\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code>pip install Pillow<\/code>\u3002\u63a5\u4e0b\u6765\uff0c\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u65cb\u8f6c\u56fe\u7247\uff1a  <\/p>\n<ol>\n<li>\u5bfc\u5165PIL\u5e93\u4e2d\u7684Image\u6a21\u5757\u3002  <\/li>\n<li>\u4f7f\u7528<code>Image.open()<\/code>\u65b9\u6cd5\u6253\u5f00\u8981\u65cb\u8f6c\u7684\u56fe\u7247\u3002  <\/li>\n<li>\u4f7f\u7528<code>rotate()<\/code>\u65b9\u6cd5\u6307\u5b9a\u65cb\u8f6c\u89d2\u5ea6\uff0c\u901a\u5e38\u4ee5\u987a\u65f6\u9488\u65b9\u5411\u65cb\u8f6c\u3002  <\/li>\n<li>\u4f7f\u7528<code>save()<\/code>\u65b9\u6cd5\u4fdd\u5b58\u65cb\u8f6c\u540e\u7684\u56fe\u7247\uff0c\u6216\u8005\u4f7f\u7528<code>show()<\/code>\u65b9\u6cd5\u67e5\u770b\u3002<\/li>\n<\/ol>\n<p><strong>\u5728Python\u4e2d\uff0c\u65cb\u8f6c\u56fe\u7247\u65f6\u6709\u54ea\u4e9b\u5e38\u89c1\u7684\u9519\u8bef\u9700\u8981\u907f\u514d\uff1f<\/strong><br \/>\u5728\u4f7f\u7528Python\u65cb\u8f6c\u56fe\u7247\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5e38\u89c1\u7684\u9519\u8bef\u5305\u62ec\uff1a  <\/p>\n<ul>\n<li><strong>\u8def\u5f84\u95ee\u9898<\/strong>\uff1a\u786e\u4fdd\u6587\u4ef6\u8def\u5f84\u6b63\u786e\uff0c\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u53ef\u4ee5\u907f\u514d\u6587\u4ef6\u627e\u4e0d\u5230\u7684\u9519\u8bef\u3002  <\/li>\n<li><strong>\u672a\u5b89\u88c5\u5e93<\/strong>\uff1a\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Pillow\u5e93\uff0c\u4f7f\u7528<code>pip show Pillow<\/code>\u53ef\u4ee5\u68c0\u67e5\u662f\u5426\u5df2\u5b89\u88c5\u3002  <\/li>\n<li><strong>\u65cb\u8f6c\u89d2\u5ea6<\/strong>\uff1a\u65cb\u8f6c\u89d2\u5ea6\u5e94\u57280-360\u5ea6\u4e4b\u95f4\uff0c\u8d85\u51fa\u8303\u56f4\u53ef\u80fd\u4f1a\u5bfc\u81f4\u610f\u5916\u7ed3\u679c\u3002  <\/li>\n<li><strong>\u6587\u4ef6\u683c\u5f0f<\/strong>\uff1a\u4fdd\u5b58\u65cb\u8f6c\u540e\u7684\u56fe\u7247\u65f6\uff0c\u786e\u4fdd\u4f7f\u7528\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u5982JPEG\u3001PNG\u7b49\uff09\u3002<\/li>\n<\/ul>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u5728Python\u4e2d\u6279\u91cf\u65cb\u8f6c\u591a\u5f20\u56fe\u7247\uff1f\u5982\u679c\u53ef\u4ee5\uff0c\u600e\u4e48\u505a\uff1f<\/strong><br \/>\u662f\u7684\uff0cPython\u53ef\u4ee5\u6279\u91cf\u65cb\u8f6c\u591a\u5f20\u56fe\u7247\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u5faa\u73af\u548c\u5217\u8868\u6765\u5904\u7406\u591a\u5f20\u56fe\u7247\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a  <\/p>\n<ol>\n<li>\u5bfc\u5165PIL\u5e93\u5e76\u5bfc\u5165os\u6a21\u5757\u4ee5\u5904\u7406\u6587\u4ef6\u8def\u5f84\u3002  <\/li>\n<li>\u4f7f\u7528<code>os.listdir()<\/code>\u51fd\u6570\u83b7\u53d6\u76ee\u6807\u6587\u4ef6\u5939\u4e2d\u7684\u6240\u6709\u56fe\u7247\u6587\u4ef6\u3002  <\/li>\n<li>\u5bf9\u6bcf\u4e2a\u6587\u4ef6\u4f7f\u7528<code>Image.open()<\/code>\u6253\u5f00\uff0c\u5e94\u7528<code>rotate()<\/code>\u65b9\u6cd5\u65cb\u8f6c\uff0c\u5e76\u4fdd\u5b58\u65cb\u8f6c\u540e\u7684\u56fe\u7247\u3002  <\/li>\n<li>\u6839\u636e\u9700\u8981\u8bbe\u7f6e\u65cb\u8f6c\u7684\u89d2\u5ea6\u548c\u8f93\u51fa\u76ee\u5f55\uff0c\u786e\u4fdd\u6240\u6709\u56fe\u7247\u90fd\u80fd\u6b63\u786e\u5904\u7406\u3002<br \/>\u8fd9\u6837\uff0c\u60a8\u5c31\u53ef\u4ee5\u9ad8\u6548\u5730\u5904\u7406\u5927\u91cf\u56fe\u7247\uff0c\u8282\u7701\u65f6\u95f4\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Python\u4e2d\u65cb\u8f6c\u56fe\u7247\uff0c\u53ef\u4ee5\u4f7f\u7528Python Imaging Library (PIL) \u6216\u8005\u662f\u5176\u5206\u652f P [&hellip;]","protected":false},"author":3,"featured_media":1018731,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1018727"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1018727"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1018727\/revisions"}],"predecessor-version":[{"id":1018733,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1018727\/revisions\/1018733"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1018731"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1018727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1018727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1018727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}