{"id":4630,"date":"2024-01-18T19:49:16","date_gmt":"2024-01-18T19:49:16","guid":{"rendered":"https:\/\/ibex.tech\/python\/?p=4630"},"modified":"2024-01-18T19:49:17","modified_gmt":"2024-01-18T19:49:17","slug":"manipulate-image","status":"publish","type":"post","link":"https:\/\/ibex.tech\/python\/images\/pillow\/manipulate-image","title":{"rendered":"Manipulate image"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Resize an image<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>from PIL import Image\r\n\r\n    image1 = Image.open(C:\/MyDirectory\/myimage.jpg\")\n\n#Use default resampling method\n    image1 = image1.resize((160,300))       \n\n#Specify resampling method\n    image1 = image1.resize((160,300), Image.Resampling.NEAREST)<\/code><\/pre>\n\n\n<p>Options:<\/p>\n<p style=\"text-align: left; padding-left: 40px;\">Image.NEAREST &#8211; use nearest neighbour<br \/>Image.BILINEAR &#8211; linear interpolation<br \/>Image.BICUBIC &#8211; cubic spline interpolation<br \/>Image.LANCZOS &#8211; a high-quality downsampling filter<\/p>","protected":false},"excerpt":{"rendered":"<p>Resize an image Options: Image.NEAREST &#8211; use nearest neighbourImage.BILINEAR &#8211; linear interpolationImage.BICUBIC &#8211; cubic spline interpolationImage.LANCZOS &#8211; a high-quality downsampling filter<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[367],"tags":[],"class_list":["post-4630","post","type-post","status-publish","format-standard","hentry","category-pillow"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/comments?post=4630"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4630\/revisions"}],"predecessor-version":[{"id":4631,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4630\/revisions\/4631"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/media?parent=4630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/categories?post=4630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/tags?post=4630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}