{"id":93,"date":"2026-03-02T17:00:07","date_gmt":"2026-03-02T09:00:07","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=93"},"modified":"2026-01-17T11:10:26","modified_gmt":"2026-01-17T11:10:26","slug":"how-to-implement-geometric-transformation-of-images-using-xlwings","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-implement-geometric-transformation-of-images-using-xlwings\/","title":{"rendered":"How To Implement Geometric Transformation of Images Using xlwings?"},"content":{"rendered":"<h2>Method<\/h2>\n<p>Using the methods provided by the `Shape` object, you can perform translation, rotation, scaling, and reflection transformations on a given graphic. The implementation of these methods is exactly the same for images.<\/p>\n<p>\u00a0<\/p>\n<p>shp=sht.api.Shapes.AddPicture(r&#8221;D:\\picpy.jpg&#8221;, True, True, 100, 50, 100, 100)<\/p>\n<p>shp.IncrementRotation(30)\u00a0\u00a0\u00a0 #Rotate 30\u00b0 clockwise around the center<\/p>\n<p>shp.Flip(0)\u00a0\u00a0\u00a0 #Horizontal flip<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Picture Geometric Transformations\n\nimport xlwings as xw    #Import xlwings package\n\napp=xw.App()\nbk=app.books.active   #Get the active workbook\nsht=bk.sheets.active    #Get the active worksheet\n\nshp=sht.api.Shapes.AddPicture(r\"D:\\picpy.jpg\", True, True, 100, 50, 100, 100)\nshp.IncrementRotation(30)    #Rotate 30\u00b0 clockwise around the center\nshp.Flip(0)    #Horizontal flip\n\n#bk.save()\n#bk.close()\n#app.kill()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"482\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/03\/image-3.png\" alt=\"Implement Geometric Transformation of Images Using xlwings\" class=\"wp-image-465\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/03\/image-3.png 786w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/03\/image-3-300x184.png 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/03\/image-3-768x471.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Method<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-93","post","type-post","status-publish","format-standard","hentry","category-xlwings-shape"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=93"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/93\/revisions"}],"predecessor-version":[{"id":466,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/93\/revisions\/466"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}