{"id":28280,"date":"2022-10-23T16:27:05","date_gmt":"2022-10-23T16:27:05","guid":{"rendered":"https:\/\/holypython.com\/?page_id=28280"},"modified":"2023-08-23T16:29:42","modified_gmt":"2023-08-23T16:29:42","slug":"how-to-draw-shapes-on-images-python-ultimate-guide","status":"publish","type":"page","link":"https:\/\/holypython.com\/python-pil-tutorial\/how-to-draw-shapes-on-images-python-ultimate-guide\/","title":{"rendered":"How to draw shapes on images with Python (PIL): The Ultimate Guide"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"28280\" class=\"elementor elementor-28280\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-38819ef elementor-reverse-mobile elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"38819ef\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-98d652e\" data-id=\"98d652e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cd1a8d1 elementor-widget elementor-widget-text-editor\" data-id=\"cd1a8d1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div>\u00a0 <a style=\"background-color: #ffffff;\" href=\"https:\/\/holypython.com\/python-pil-tutorial\/\">&lt;&lt;&lt; PIL Tutorials<\/a><\/div><hr \/><ol><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-create-a-new-image-with-pil\/\"><span style=\"font-weight: bold;\">Create<\/span> a new image<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-open-show-and-save-images-in-python-pil\/\"><b>Open<\/b>, <b>Show<\/b> &amp; <b>Save<\/b> images (PIL)<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/pasting-merging-blending-images-with-python-pil\/\"><b>Paste<\/b>, <b>Merge<\/b>, <b>Blend<\/b> images (PIL)<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-draw-shapes-on-images-python-ultimate-guide\/\">How to <b>Draw<\/b> shapes images (PIL)<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-crop-images-with-python-pil\/\">How to <b>Crop <\/b>an image (PIL)<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-add-text-to-images-in-python-via-pil-library\/\">How to <b>Add Text<\/b> to images (PIL)<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-add-frames-to-images-in-python-via-pil-library\/\">How to <b>Add Frames<\/b> to images (PIL)<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-resize-an-image-and-get-size-in-python-pil\/\">How to <b>Resize <\/b>an image (PIL)<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-adjust-brightness-contrast-sharpness-and-saturation-of-images-in-python-pil\/\"><b>Brightness<\/b>, <b>Contrast<\/b>, <b>Saturation\u00a0<\/b><\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-convert-an-image-to-black-white-in-python-pil\/\">Convert image to <span style=\"font-weight: bold;\">Grayscale | B&amp;W<\/span><\/a><span style=\"font-weight: bold;\"><br \/><\/span><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/creating-photo-collages\/\">Create <span style=\"font-weight: bold;\">Photo Collages<\/span><\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/color-modes-explained-for-digital-image-processing-in-python-pil\/\">Digital Image <b>Color Modes<\/b>\u00a0<\/a><\/li><li><a href=\"https:\/\/holypython.com\/digital-image-basics-with-pil-library-in-python\/\">Digital Image <span style=\"font-weight: bold;\">Basics<\/span><\/a><\/li><li><a href=\"https:\/\/holypython.com\/image-manipulation-with-python-pil\/\"><b>Image Manipulation<\/b> w\/ PIL<\/a><\/li><li><a href=\"https:\/\/holypython.com\/how-to-batch-resize-multiple-images-in-python-via-pil-library\/\"><span style=\"font-weight: bold;\">Batch Resize<\/span> Multiple Images (PIL)<\/a><\/li><li><a href=\"https:\/\/holypython.com\/how-to-watermark-images-w-python-pil\/\"><span style=\"font-weight: bold;\">Watermarking<\/span> Images<\/a><\/li><li><a href=\"https:\/\/holypython.com\/python-code-to-show-the-difference-between-2-images\/\"><b>Difference Between 2<\/b> Images (PIL)<\/a><\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-820bd33\" data-id=\"820bd33\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-2eacc4c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2eacc4c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-1d7add4\" data-id=\"1d7add4\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-c9dba6c elementor-widget elementor-widget-heading\" data-id=\"c9dba6c\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h1 class=\"elementor-heading-title elementor-size-default\">How to draw shapes on images with Python (PIL): The Ultimate Guide<\/h1>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-3a3ccc8\" data-id=\"3a3ccc8\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-c2b20c6 elementor-widget elementor-widget-image\" data-id=\"c2b20c6\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"960\" height=\"1108\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2.png\" class=\"attachment-full size-full wp-image-28486\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2.png 960w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2-260x300.png 260w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2-887x1024.png 887w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2-768x886.png 768w\" sizes=\"(max-width: 960px) 100vw, 960px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Python triangular crop<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-e70abf7 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e70abf7\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-edea862\" data-id=\"edea862\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-832cee4 elementor-widget elementor-widget-menu-anchor\" data-id=\"832cee4\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"intro\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0de95f4 elementor-widget elementor-widget-text-editor\" data-id=\"0de95f4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Geometric shapes are a big part of our online and offline worlds and mastering certain skills with regards to geometric shapes can provide propitious circumstances in both short term and long term. If you think about it for a moment, you will realize how much space geometric shapes occupy in our daily lives.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-c4003f4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c4003f4\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-3689262\" data-id=\"3689262\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-759a8a0 elementor-widget elementor-widget-heading\" data-id=\"759a8a0\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Contents<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8028e04 elementor-widget elementor-widget-text-editor\" data-id=\"8028e04\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li><a href=\"#intro\">Introduction<\/a><\/li><li><a href=\"#what_is_cropping\">What is a geometric shape?<\/a><\/li><li><a href=\"#what_to_do_with_geometric_shapes\">What to do with geometric shapes on an image?<\/a><\/li><li>How to draw geometric shapes with Python&#8217;s PIL (pillow) image editing library?<ul><li><a href=\"#draw_square\">How to draw a <u><b>square<\/b><\/u>?<\/a><\/li><li><a href=\"#draw_rectangle\">How to draw a <u><b>rectangle<\/b><\/u>?<\/a><\/li><li><a href=\"#draw_circle\">How to draw a <u><b>circle<\/b><\/u> or <u><b>ellipse<\/b><\/u>?<\/a><\/li><li><a href=\"#draw_triangle\">How to draw a <u><b>triangle<\/b><\/u>?<\/a><\/li><li><a href=\"#draw_polygons\">How to draw polygons like pentagon, hexagon, septagon or octagon?<\/a><\/li><\/ul><\/li><li><a href=\"#drawing_geometric_shapes_with_text_python\">Drawing geometric shapes with text<\/a><\/li><li><a href=\"#advanced_combinations\">Advanced combinations<\/a><\/li><li><a href=\"#cropping_images_in_geometric_shapes\">Cropping images as <b>geometric shapes<\/b> <\/a><\/li><li><a style=\"background-color: #ffffff;\" href=\"#summary\">Summary<\/a><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-32a7875 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"32a7875\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-2069535\" data-id=\"2069535\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-c3201c5 elementor-widget elementor-widget-menu-anchor\" data-id=\"c3201c5\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"what_is_cropping\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8f25ec9 elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"8f25ec9\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Introduction: Geometric Shapes in Daily Life<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-27b8142 elementor-widget elementor-widget-text-editor\" data-id=\"27b8142\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>For instance, most mobile phones, desks, beds, screens, laptops, buttons, books and windows have rectangular shapes while pizza is almost always circular (except Sicilian pizza) and its slices resemble triangles. Signs and flags concerning nautical, aviation, road and rail transportation can have circular, hexagonal or octagonal as well as triangular shapes.<\/p><p>Particularly for niche sub-domains under engineering, online businesses, digital image manipulation, architecture and e-learning geometric shapes are irreplaceable.<\/p><p>Some example fields would be:<\/p><ul><li>online learning,<\/li><li>architectural design,<\/li><li>computational photography,<\/li><li>computer vision &#8211; (AI),<\/li><li>web development &#8211; (UI\/UX),<\/li><li>online marketing and<\/li><li>digital advertising,<\/li><li>game development,<\/li><li>manufacturing,<\/li><li>contemporary art, digital art &amp; NFTs<\/li><\/ul><p>Geometric shapes get plenty of utilization in both digital and physical applications and the list above is a tiny representation of where we might see utilization of geometric shapes.<\/p><p>In this tutorial, we will use Python to draw geometric shapes, combine geometric shapes with images and demonstrate several use cases of geometric shapes through Python examples.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-80bae7e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"80bae7e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-49910af\" data-id=\"49910af\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d2ccb3e elementor-widget elementor-widget-menu-anchor\" data-id=\"d2ccb3e\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"what_is_cropping\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-08dddc1 elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"08dddc1\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What is a geometric shape?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-44b2c9f elementor-widget elementor-widget-text-editor\" data-id=\"44b2c9f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A geometric shape is a two-dimensional or three-dimensional enclosed figure that has specific properties such as length, width, and height. Geometric shapes are the basis for more complex figures and structures in geometry and are often used in everyday life to describe and analyze the world around us. <\/p><p>Examples of geometric shapes include Square, Triangle, Circles, Rectangles, Hexagons, Pentagons, Octagons, Decagons, Parallelogram, Ellipse, Oval, Rhombus, Trapezoid, Kite, Star, Cone, Cylinder, Sphere, Cube, Cuboid, Prism, Pyramid, Torus .<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-b3c3a7e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"b3c3a7e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-e3b24f0\" data-id=\"e3b24f0\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9824aa4 elementor-widget elementor-widget-menu-anchor\" data-id=\"9824aa4\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"what_to_do_with_geometric_shapes\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-428a9b9 elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"428a9b9\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What to do with geometric shapes on images?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e477cdc elementor-widget elementor-widget-text-editor\" data-id=\"e477cdc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Understanding the utilization of geometric shapes can be useful in a vast spectrum of tasks in many industries. Although this tutorial focuses on creating geometric shapes on images. it might be useful to understand the scope of operations that can be carried out using geometric shapes. Here are some more examples.<\/p><ul><li>To create indicators &amp; mark objects, items, areas of images<\/li><li>To create logos, signs, quotes, frames, branding<\/li><li>To create text on images with aesthetic semi-transparent background layer for increased readability<\/li><li>To crop images in geometric shapes (triangle, circle, square, rounded rectangle, ellipse, pentagon, hexagon etc.)<\/li><li>To manufacture objects, items, gadgets, electronics, furniture etc.<\/li><li>To calculate positions of celestial bodies in outer space<\/li><li>To publish books, calendars, notebooks<\/li><li>To create or supplement modern art pieces.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-813630c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"813630c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-b7756ea\" data-id=\"b7756ea\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a404716 elementor-widget elementor-widget-menu-anchor\" data-id=\"a404716\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"what_to_do_with_cropping\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cfa5a67 elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"cfa5a67\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">How to draw geometric shapes on images with Python's PIL (pillow) image editing library?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f864ede elementor-widget elementor-widget-text-editor\" data-id=\"f864ede\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Python&#8217;s image editing library PIL (pillow) makes it very convenient for drawing geometric shapes on images and it provides many options to fine tune these drawings and shapes.<\/p><p>To draw geometric shapes we will use <code>ImageDraw<\/code> module from the PIL library. It can be imported as in the Python code below:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-15d0b08 elementor-widget elementor-widget-html\" data-id=\"15d0b08\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw\r\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2004241 elementor-widget elementor-widget-text-editor\" data-id=\"2004241\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We are also importing the <code>Image<\/code> module as it will be used for opening images or creating new images.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0d2d7fa elementor-widget elementor-widget-text-editor\" data-id=\"0d2d7fa\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Once we&#8217;ve imported the modules we need from the PIL library, we can start using them to draw geometric shapes.<\/p><p>Below, you can see detailed tutorial sections explaining how to draw various geometric shapes on an image, starting with the square.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-6735365 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6735365\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-92f2390\" data-id=\"92f2390\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-db4250d elementor-widget elementor-widget-menu-anchor\" data-id=\"db4250d\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"draw_square\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-351f825 elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"351f825\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">How to draw a square?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-62afc45 elementor-widget elementor-widget-text-editor\" data-id=\"62afc45\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Square is a geometric shape with 4 equal sides and 4 right angles (90 degrees) between them.<\/p><p>Using Python&#8217;s <code>ImageDraw<\/code> module we can draw square shapes on any image and any coordinate on that image. We can also specify a fill color or outline color and we can even adjust transparency of the square by using more advanced Python image editing techniques. We can use 2 methods from ImageDraw to achieve a square shape.<\/p><ul><li><code>ImageDraw.rectangle()<\/code><\/li><li><code>ImageDraw.regular_polygon()<\/code><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8bb235f elementor-widget elementor-widget-text-editor\" data-id=\"8bb235f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In the next section, you can see a rectangle example drawn using the rectangle method. If you make sure the first argument has equal x and y values you will end up with a square instead of a rectangle. The first attribute defines the coordinates of the square (or rectangle) as following.<\/p><ul><li><code>(x0, y0, x1, y1)<\/code><\/li><\/ul><p>If you check out the example below you will see that both x1 &#8211; x0 and y1 &#8211; y0 are equal which results in a square drawing. By increasing x1 or y1 you could create a rectangle as well.<\/p><p>&#8220;<u>From example below<\/u>&#8220;<\/p><ul><li><code>(100, 100, 300, 300)<\/code><\/li><\/ul><ul><li>300 &#8211; 100 = 200 (horizontal sides)<\/li><li>300 &#8211; 100 = 200 (vertical sides)<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6f9fb0e elementor-widget elementor-widget-html\" data-id=\"6f9fb0e\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw\r\n\r\nimg = Image.new(\"RGBA\", (500,500))\r\ndraw = ImageDraw.Draw(img)\r\n\r\ndraw.rectangle((100,100,300,300), outline='teal', fill='orange', width=25)<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e282d95 elementor-widget elementor-widget-html\" data-id=\"e282d95\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>img.show()<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c184ecd elementor-widget elementor-widget-text-editor\" data-id=\"c184ecd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We get a cool rectangle with orange fill and teal outline with 25 pixel thickness.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-933cbb3 elementor-widget elementor-widget-image\" data-id=\"933cbb3\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"402\" height=\"402\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/rectangle_outline_fill_V1.png\" class=\"attachment-full size-full wp-image-28467\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/rectangle_outline_fill_V1.png 402w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/rectangle_outline_fill_V1-300x300.png 300w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/rectangle_outline_fill_V1-150x150.png 150w\" sizes=\"(max-width: 402px) 100vw, 402px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Square with orange fill<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-14dc8c9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"14dc8c9\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-12b6263\" data-id=\"12b6263\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a92bd75 elementor-widget elementor-widget-menu-anchor\" data-id=\"a92bd75\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"draw_rectangle\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e6d589e elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"e6d589e\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">How to draw a rectangle?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fdbb3cd elementor-widget elementor-widget-text-editor\" data-id=\"fdbb3cd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A rectangle is also a:<\/p><ul><li>right-angled parallellogram (all parallel sides with 4 right angles)<\/li><li>quadrilateral or equiangular quadrilateral<\/li><li>4-sided polygon<\/li><\/ul><p>A square is a unilateral rectangle but not all rectangles are square as they might have different side sizes.<\/p><p>Rectangle is one of the most commonly utilized geometric shape in the industrial world and it can be convenient in designing real estate property, furniture, digital work, images, consumer products, books and countless others.<\/p><ul><li><code>ImageDraw.rectangle()<\/code><\/li><li><code>ImageDraw.polygon()<\/code><\/li><li><code>ImageDraw.regular_polygon()<\/code><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-63f7e8c elementor-widget elementor-widget-html\" data-id=\"63f7e8c\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw\n\nimg = Image.new(\"RGBA\", (500,500))\ndraw = ImageDraw.Draw(img)\n\ndraw.rectangle((100,100,500,300), outline='navy', fill='mediumspringgreen', width=25)\nimg.show()\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9935411 elementor-widget elementor-widget-image\" data-id=\"9935411\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"800\" height=\"402\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/12\/PIL_python_rectangles.png\" class=\"attachment-full size-full wp-image-29306\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/12\/PIL_python_rectangles.png 800w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/12\/PIL_python_rectangles-300x151.png 300w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/12\/PIL_python_rectangles-768x386.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Rectangle with green fill and navy outline<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-042b002 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"042b002\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-16986ed\" data-id=\"16986ed\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d8a4dea elementor-widget elementor-widget-menu-anchor\" data-id=\"d8a4dea\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"draw_circle\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2a6b3bc elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"2a6b3bc\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">How to draw a circle?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a427834 elementor-widget elementor-widget-text-editor\" data-id=\"a427834\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Square is a geometric shape with 4 equal sides and 4 right angles (90 degrees) between them.<\/p><p>Using Python&#8217;s <code>ImageDraw<\/code> module we can draw square shapes on any image and any coordinate on that image. We can also specify a fill color or outline color and we can even adjust transparency of the square by using more advanced Python image editing techniques. We can use 2 methods from ImageDraw to achieve a square shape.<\/p><ul><li><code>ImageDraw.rectangle()<\/code><\/li><li><code>ImageDraw.regular_polygon()<\/code><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-10bcb27 elementor-widget elementor-widget-text-editor\" data-id=\"10bcb27\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div>Here are the results of both images upon using the <code>.show()<\/code> method after our Python codes.<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-94cdf64 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"94cdf64\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-c7796cc\" data-id=\"c7796cc\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-58e5fd9 elementor-widget elementor-widget-html\" data-id=\"58e5fd9\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw \r\n\r\nimg = Image.new(\"RGBA\", (1000,1000))\r\ndraw = ImageDraw.Draw(img)\r\ndraw.ellipse((100,100,600,600), fill=(100,100,255,255), \r\n                outline=\"yellow\", width=25)\r\n\r\nimg.show()<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0f5f314 elementor-widget elementor-widget-text-editor\" data-id=\"0f5f314\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div>This Python examples demonstrates a perfect circle drawing however, you could also draw an ellipse using the same <b>draw.ellipse<\/b> method.<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bb29a50 elementor-widget elementor-widget-image\" data-id=\"bb29a50\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"501\" height=\"501\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V2.png\" class=\"attachment-full size-full wp-image-28509\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V2.png 501w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V2-300x300.png 300w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V2-150x150.png 150w\" sizes=\"(max-width: 501px) 100vw, 501px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Circle with blue fill color and yellow outline<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-d08a692 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d08a692\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-36156d8\" data-id=\"36156d8\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9df6cca elementor-widget elementor-widget-heading\" data-id=\"9df6cca\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Creative use of circle drawing on images<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cc6260a elementor-widget elementor-widget-text-editor\" data-id=\"cc6260a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Here is another example without the fill argument. Circles below are used to outline the faces of two humans with different colors using Python PIL. Such outlines are often used in autonomous driving, computer vision and machine learning applications such as pattern recognition or face detection.<\/p><p>Check out the code and the resulting image below.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d23de7a elementor-widget elementor-widget-html\" data-id=\"d23de7a\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw \r\n\r\nimg = Image.open(\"\/home\/humans.jpg\")\r\ndraw = ImageDraw.Draw(img)\r\ndraw.ellipse((100,100,600,600), fill=(100,100,255,255), \r\n                outline=\"yellow\", width=25)\r\n\r\nimg.show()<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-58c2e14 elementor-widget elementor-widget-image\" data-id=\"58c2e14\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1152\" height=\"765\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V6.png\" class=\"attachment-full size-full wp-image-28513\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V6.png 1152w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V6-300x199.png 300w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V6-1024x680.png 1024w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circle_simple_V6-768x510.png 768w\" sizes=\"(max-width: 1152px) 100vw, 1152px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Python circles with outlines and without fill color<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3b0b861 elementor-widget elementor-widget-text-editor\" data-id=\"3b0b861\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Another Python drawing example for consulting or branding opportunities. This technique can also be used to stamp hundreds of images using Python loops with the branding-related drawing.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7cb0307 elementor-widget elementor-widget-image\" data-id=\"7cb0307\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1104\" height=\"621\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circles_consulting_branding_V2.png\" class=\"attachment-full size-full wp-image-28505\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circles_consulting_branding_V2.png 1104w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circles_consulting_branding_V2-300x169.png 300w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circles_consulting_branding_V2-1024x576.png 1024w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/circles_consulting_branding_V2-768x432.png 768w\" sizes=\"(max-width: 1104px) 100vw, 1104px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Three consecutive circles drawn with Python PIL as an example of branding<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ca84def elementor-widget elementor-widget-text-editor\" data-id=\"ca84def\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Here is the Python code that&#8217;s used to create the image with 3 circles above.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4fd3cbf elementor-widget elementor-widget-html\" data-id=\"4fd3cbf\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw\r\n\r\nimg = Image.open('\/home\/consulting_branding.jpg')\r\n\r\ndraw = ImageDraw.Draw(img)\r\nx,y = 1900, 1200\r\nmargin = 100\r\ndraw.ellipse((x, y, x+margin, y+margin), fill=(100,100,255,255))\r\ndraw.ellipse((x+150, y, x+150+margin, y+margin), fill=(100,255,100,255))\r\ndraw.ellipse((x+300, y, x+300+margin, y+margin), fill=(255,100,100,255))\r\n\r\nimg.show()<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-a0b37de elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a0b37de\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-5408085\" data-id=\"5408085\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-8955848 elementor-widget elementor-widget-menu-anchor\" data-id=\"8955848\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"draw_triangle\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6402e02 elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"6402e02\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">How to draw a triangle?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-18af4ca elementor-widget elementor-widget-text-editor\" data-id=\"18af4ca\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Square is a geometric shape with 4 equal sides and 4 right angles (90 degrees) between them.<\/p><p>Using Python&#8217;s <code>ImageDraw<\/code> module we can draw square shapes on any image and any coordinate on that image. We can also specify a fill color or outline color and we can even adjust transparency of the square by using more advanced Python image editing techniques. We can use 2 methods from ImageDraw to achieve a square shape.<\/p><ul><li><code>ImageDraw.rectangle()<\/code><\/li><li><code>ImageDraw.regular_polygon()<\/code><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-11e0319 elementor-widget elementor-widget-html\" data-id=\"11e0319\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw, ImageFilter\r\n\r\nimg = Image.open('\/home\/usa.jpg')\r\n\r\ndraw = ImageDraw.Draw(img)\r\ndraw.regular_polygon((1400,400,250), 3, fill=(100,100,255,255))\r\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7f272aa elementor-widget elementor-widget-html\" data-id=\"7f272aa\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>img.show()\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-07ac43e elementor-widget elementor-widget-text-editor\" data-id=\"07ac43e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div>Here are the results of both images upon using the <code>.show()<\/code> method after our Python codes.<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-b331c3d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"b331c3d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-47c0b3f\" data-id=\"47c0b3f\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ab1ef2e elementor-widget elementor-widget-menu-anchor\" data-id=\"ab1ef2e\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"draw_polygons\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7803267 elementor-widget__width-auto elementor-widget elementor-widget-heading\" data-id=\"7803267\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">How to draw polygons like pentagon, hexagon, septagon or octagon?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fc99550 elementor-widget elementor-widget-text-editor\" data-id=\"fc99550\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A <u><b>polygon<\/b><\/u> is a 2D shape that has multiple straight sides which form a closed plane figure.<\/p><p>A <b><u>regular polygon<\/u><\/b> is a <i>equiangular<\/i> and <i>equilateral<\/i> shape polygon shape. This means all regular polygons must have equal angles and equal sides.<\/p><p>Technically, many geometric shapes qualify as polygons. Some categorization examples are as following.<\/p><p><b><u>Polygons<\/u>:<\/b><\/p><ul><li>triangle (3-sided),<\/li><li>rectangle (4-sided),<\/li><li>trapezoid (4-sided),<\/li><li>parallelogram (4-sided),<\/li><li>rhombus (4-equal-sided),<\/li><li>kite (4-sided),<\/li><\/ul><div><b><u>Regular Polygons<\/u>:<\/b><\/div><div><ul><li>equilateral triangle (3-sided),<\/li><li>square (4-sided),<\/li><li>pentagon (5-sided),<\/li><li>hexagon (6-sided),<\/li><li>septagon (7-sided),<\/li><li>octagon (8-sided),<\/li><li>nonagon (9-sided),<\/li><li>decagon (10-sided)<\/li><\/ul><div>All regular polygons are also simple polygons.<\/div><\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3c9d3f7 elementor-widget elementor-widget-text-editor\" data-id=\"3c9d3f7\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We can conveniently draw polygons such as pentagon, hexagon, septagon, octagon nanogon (enneagon) or decagon etc.. using Python and the PIL (pillow library).<\/p><p>Using Python&#8217;s <code>ImageDraw<\/code> module we can initiate the draw object&#8217;s handle on an existing or new image. Then we can use <code>ImageDraw.regular_polygon()<\/code> and define the bounding circle and number of sides as well as some other attributes such as fill color.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ca32e6f elementor-widget elementor-widget-text-editor\" data-id=\"ca32e6f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Let&#8217;s draw a pentagon using the ImageDraw module from Python&#8217;s Pillow library.<\/p><p>Firstly, we can import the libraries we need and create a new image in RGBA mode. Check out our tutorial regarding RGBA color modes but RGBA allows us to have transparency layer (alpha layer) in case transparency is needed. 500&#215;500 pixels should be a fine image dimension for the sake of this demonstration.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0a873f0 elementor-widget elementor-widget-html\" data-id=\"0a873f0\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw\r\nimg = Image.new(\"RGBA\", (500,500))\r\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f06daee elementor-widget elementor-widget-text-editor\" data-id=\"f06daee\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Next, we will need a draw object which we can use as a drawing handle. Draw object can be created on the image we just created. Then we can draw a pentagon which is nothing but a polygon with 5 sides. As the filling color let&#8217;s use &#8220;lightslategray&#8221;.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-858486a elementor-widget elementor-widget-html\" data-id=\"858486a\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>draw = ImageDraw.Draw(img)\r\ndraw.regular_polygon((100,100,100), 5, fill='lightslategray')<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7150e7b elementor-widget elementor-widget-text-editor\" data-id=\"7150e7b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>That&#8217;s it. It&#8217;s that easy drawing a sophisticated geometric shape on an image with Python. We can now show the image and check out how it came out.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-30ff5b2 elementor-widget elementor-widget-html\" data-id=\"30ff5b2\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>img.show()\r\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-3bbed58 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3bbed58\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-8cb6b51\" data-id=\"8cb6b51\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-511eda5 elementor-widget elementor-widget-image\" data-id=\"511eda5\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"724\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/simple_pentagon_V2.png\" class=\"attachment-full size-full wp-image-28449\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/simple_pentagon_V2.png 764w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/simple_pentagon_V2-300x284.png 300w\" sizes=\"(max-width: 764px) 100vw, 764px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Resulting image from 5 sided polygon with Python Pillow<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-986540c\" data-id=\"986540c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5c1700c elementor-widget elementor-widget-image\" data-id=\"5c1700c\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"696\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/simple_hexagon_V2.png\" class=\"attachment-full size-full wp-image-28451\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/simple_hexagon_V2.png 802w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/simple_hexagon_V2-300x260.png 300w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/simple_hexagon_V2-768x666.png 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">This Hexagon can be created just by changing sides to 6 and color to seagreen<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-5ed87aa elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5ed87aa\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-ba28352\" data-id=\"ba28352\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-8c4f89a elementor-widget elementor-widget-menu-anchor\" data-id=\"8c4f89a\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"drawing_geometric_shapes_with_text_python\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3b774d9 elementor-widget elementor-widget-heading\" data-id=\"3b774d9\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Drawing geometric shapes with text using Python<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2711fdf elementor-widget elementor-widget-text-editor\" data-id=\"2711fdf\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Of course you can articulate your coding project and create very interesting, utilitarian and meaningful shapes, objects and material.<\/p><p>For demonstration purposes, check out the stop sign created with a very similar Python code. This image involves an 8 sided red polygon shape with STOP written on it and it resembles the traffic sign stop.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e1c07d elementor-widget elementor-widget-image\" data-id=\"8e1c07d\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"372\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/stop_sign_octagon.png\" class=\"attachment-full size-full wp-image-28448\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/stop_sign_octagon.png 372w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/stop_sign_octagon-300x300.png 300w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/stop_sign_octagon-150x150.png 150w\" sizes=\"(max-width: 372px) 100vw, 372px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-305f4e6 elementor-widget elementor-widget-text-editor\" data-id=\"305f4e6\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Here&#8217;s the code which is required to create an image like above.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-81aec0f elementor-widget elementor-widget-html\" data-id=\"81aec0f\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code>from PIL import Image, ImageDraw, ImageFont\n\nimg = Image.new(\"RGBA\", (500,500))\n\ndraw = ImageDraw.Draw(img)\nfont = ImageFont.truetype('Inconsolata-Bold.ttf', 70)\n\ndraw.regular_polygon((200,200,200), 6, fill='seagreen')\ndraw.text((30,65), \"STOP\", fill='white', font=font)\n\nimg.show()\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-49f12b4 elementor-widget elementor-widget-text-editor\" data-id=\"49f12b4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We have an extensive tutorial about writing text on images using Python with quite a few cool Python examples so feel free to check that out as well for more ideas and technical skills as well.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-7d41d0a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7d41d0a\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-d697689\" data-id=\"d697689\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-953e215 elementor-widget elementor-widget-menu-anchor\" data-id=\"953e215\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"advanced_combinations\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-154bd6c elementor-widget elementor-widget-heading\" data-id=\"154bd6c\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Advanced combinations of geometric shapes and text<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-76e8e98 elementor-widget elementor-widget-text-editor\" data-id=\"76e8e98\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Using the ImageDraw module you can create more advanced combinations that can become part of your services or products.<\/p><p>The example below makes use of multiple creative elements and harmonizes computer code with visual aesthetics and intellectual property such as:<\/p><ul><li>rounded rectangle shape<\/li><li><a href=\"https:\/\/holypython.com\/python-pil-tutorial\/color-modes-explained-for-digital-image-processing-in-python-pil\/\">RGBA mode<\/a> with transparency layer<\/li><li>a stunning sky-mountain image by <a href=\"https:\/\/www.instagram.com\/michaelbaccin\/\">Michael Baccin<\/a> (<span class=\"TVqgS\"><span class=\"e6qY8 pXBzI RZQOk\">Passo Fiorine, Padua, Italy<\/span><\/span>)<\/li><li><a href=\"https:\/\/fonts.google.com\/?query=Raph+Levien\">Inconsolata truetype font<\/a> by Raph Levien<\/li><li>named <a href=\"https:\/\/holypython.com\/python-visualization-tutorial\/colors-with-python\/\">Python colors<\/a> (&#8220;teal&#8221;)<\/li><li>inspirational quote by Ken Poirot<\/li><li>and Python PIL text object (from the ImageDraw module)<\/li><\/ul><div>Result is a gorgeous and inspiring visual created with a few lines of <a href=\"https:\/\/holypython.com\/python-scripting-tutorial\/what-is-python-code\/\">Python code<\/a>.<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-086ffeb elementor-widget elementor-widget-image\" data-id=\"086ffeb\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"960\" height=\"1108\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2.png\" class=\"attachment-full size-full wp-image-28486\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2.png 960w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2-260x300.png 260w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2-887x1024.png 887w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/11\/text_on_rounded_rectangle_V2-768x886.png 768w\" sizes=\"(max-width: 960px) 100vw, 960px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9c42a03 elementor-widget elementor-widget-text-editor\" data-id=\"9c42a03\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tHere is the full code used to create the visual above.<br>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-34c8236 elementor-widget elementor-widget-html\" data-id=\"34c8236\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre rel=\"Python\"><code># Importing modules and opening an image\nfrom PIL import Image, ImageDraw, ImageFilter, ImageFont\nimg = Image.open('\/home\/sky.jpg').convert(\"RGBA\")\nbackground = Image.new(\"RGBA\", img.size, (0,0,0,0))\n\n# Drawing rounded rectangle with transparency on transparency layer and combining it with the opened image.\ndraw = ImageDraw.Draw(background)\ndraw.rounded_rectangle((200,400,2200,1900), 360, fill=(210,220,280,70), outline=None)\nnew_img = Image.composite(background, img, background)\n\n# Typing inspirational quote and author's name on the new image with rounded rectangle\/\ndraw2 = ImageDraw.Draw(new_img)\nfont1 = ImageFont.truetype('Inconsolata-Regular.ttf', 180,)\nfont2 = ImageFont.truetype('Inconsolata-Light.ttf', 170)\ndraw2.text((300,500), \"\"\"\n   Today is your\n   opportunity to\nbuild the tomorrow\n     you want.\"\"\", font=font1, fill=(50,50,50))\ndraw2.text((1100,1600), \"KEN POIROT\", font=font2, fill='teal')\n\nnew_img.show()\n\nimg.show()\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-7cc1cd2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7cc1cd2\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-f68b577\" data-id=\"f68b577\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-02218ff elementor-widget elementor-widget-menu-anchor\" data-id=\"02218ff\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"drawing_geometric_shapes_with_text_python\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4f840ec elementor-widget elementor-widget-heading\" data-id=\"4f840ec\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Legal Aspects of Geometric Shapes<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-54009aa elementor-widget elementor-widget-text-editor\" data-id=\"54009aa\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>If you are working with geometric shapes you might eventually encounter a situation where law is also part of the equation.<\/p><p>Established artists, developers and businesses usually aim to protect their brand and\/or work by registering trademarks or copyrights of their intellectual properties (IPs).<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-caf9f2b elementor-widget elementor-widget-heading\" data-id=\"caf9f2b\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Trademark vs Copyright<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e9913d1 elementor-widget elementor-widget-text-editor\" data-id=\"e9913d1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>While both trademark and copyright are intellectual properties, they are easily distinguishable due to a significant difference. Trademark can be applied to an item concerning the brand of a company or an individual such as logo, name, product name, coloring etc that represents the company while copyright is usually applied for the content of a specific work.<\/p><p><i><b>It can be said that trademark is registered concerning the source of the work (brand name, logo etc.) while copyright applies to the work (product, art, text, drawing, design etc.) itself.<\/b><\/i><\/p><p>For example, design of a logo representing can be registered as a trademark for a company (given that it satisfies all the necessary requirements), while design work created for a project might be registered for copyright to eliminate IP theft.<\/p><p>While both trademarks and copyrights protect intellectual property, they serve different purposes and have different legal requirements for protection. Trademarks are used to prevent consumer confusion and protect the reputation and goodwill of a company or brand, while copyrights are used to protect the creative expression of an individual or group.<\/p><p>Additionally, the duration of protection for trademarks and copyrights also differs. Trademarks can be renewed indefinitely as long as they are in use, while copyrights typically last for the life of the creator plus a certain number of years after their death.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e09c2f4 elementor-widget elementor-widget-heading\" data-id=\"e09c2f4\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Can I copyright a geometric shape?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-405efc7 elementor-widget elementor-widget-text-editor\" data-id=\"405efc7\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In most cases, it is not possible to copyright a geometric shape. Copyright law protects original works of authorship, such as literary, artistic, or musical works. A geometric shape, by itself, is not considered a work of authorship and is not eligible for copyright protection.<\/p><p>However, there are some exceptions to this general rule. If a geometric shape is used as part of a logo, for example, the logo as a whole may be eligible for copyright protection. In this case, the geometric shape would be protected as part of the overall design of the logo.<\/p><p>Additionally, if a geometric shape is used as part of a sculpture or other artistic work, the sculpture or artwork as a whole may be eligible for copyright protection. In this case, the geometric shape would be protected as part of the overall creative expression of the work.<\/p><p>In general, however, a geometric shape by itself is not eligible for copyright protection. If you have specific questions about copyright and geometric shapes, it is best to consult with an attorney who specializes in copyright law.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b473323 elementor-widget elementor-widget-heading\" data-id=\"b473323\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Can I register a geometric shape as trademark?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-53526a1 elementor-widget elementor-widget-text-editor\" data-id=\"53526a1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Similar to the copyright of geometric shapes it&#8217;s quite difficult to register a geometric shape as a trademark.<\/p><p>A company named IGT tried to register geometric shapes used in their game machines and expectedly they were refused to do that. Later when they appealed a similar outcome occurred after the previous refusal decision was reconfirmed by Trademark Trial and Appeal Board (TTAB) of United States Patent and Trademark Office (USPTO).<\/p><p>Accross the pond UK Government also has a very clear and informative guideline regarding untrademarkable items where it is stated that:<\/p><blockquote><p>Trade marks are acceptable if they are:<\/p><ul><li>distinctive for the goods and services you provide<\/li><\/ul><p>In other words they can be recognised as signs that differentiates your goods or service as different from someone else\u2019s.<\/p><\/blockquote><p>Since geometric shapes are most likely not distinctive for a single company, it is usually quite difficult to trademark them. Having said that there might be cases where a brand reaches enough distinction to actually be able to register some form of a geometric shape as their trademark. Please discuss with your attorney for professional advise.<\/p><p><u>You can search existing trademark databases from relevant links:<\/u><\/p><p>&#8211; <b><u><i>USA<\/i><\/u><\/b>: United States Patent and Trademark Office &#8211; <a href=\"https:\/\/www.uspto.gov\/trademarks\/search\">Search USA Trademark Database<\/a>\u00a0<\/p><p>&#8211; <b><u><i>UK<\/i><\/u><\/b>: Intellectual Property Office &#8211; <a href=\"https:\/\/trademarks.ipo.gov.uk\/ipo-tmtext\">Search UK Trademark Database<\/a><\/p><p>&#8211; <b><u><i>Canada<\/i><\/u><\/b>: Canadian Intellectual Property Office &#8211; <a href=\"https:\/\/www.ic.gc.ca\/app\/opic-cipo\/trdmrks\/srch\/home?lang=eng\">Search Canada Trademark Database<\/a><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-98e27ec elementor-widget elementor-widget-image\" data-id=\"98e27ec\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2020\/09\/5lphHWTYnc-Custom.jpg\" class=\"attachment-full size-full wp-image-14911\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2020\/09\/5lphHWTYnc-Custom.jpg 1200w, https:\/\/holypython.com\/wp-content\/uploads\/2020\/09\/5lphHWTYnc-Custom-300x200.jpg 300w, https:\/\/holypython.com\/wp-content\/uploads\/2020\/09\/5lphHWTYnc-Custom-1024x683.jpg 1024w, https:\/\/holypython.com\/wp-content\/uploads\/2020\/09\/5lphHWTYnc-Custom-768x512.jpg 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-cf9407e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"cf9407e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-c186fb3\" data-id=\"c186fb3\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-78f7484 elementor-widget elementor-widget-menu-anchor\" data-id=\"78f7484\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"cropping_images_in_geometric_shapes\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ead52b4 elementor-widget elementor-widget-heading\" data-id=\"ead52b4\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Cropping Images in Geometric Shapes with Python<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1dac6ed elementor-widget elementor-widget-text-editor\" data-id=\"1dac6ed\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div>We also have a <a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-crop-images-with-python-pil\/\">Python image cropping tutorial<\/a> in which you can find Python examples to crop images in pretty much any geometric shape.<\/div><div>\u00a0<\/div><div>Here are some examples from that tutorial.<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-d585f90 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d585f90\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-inner-column elementor-element elementor-element-35b02d7\" data-id=\"35b02d7\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-707c782 elementor-widget elementor-widget-heading\" data-id=\"707c782\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\">Pentagon Cropping<\/h5>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4a6e87b elementor-widget elementor-widget-image\" data-id=\"4a6e87b\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/pentagonal_crop_small.png\" title=\"\" alt=\"\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Python Image with pentagonal cropping<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-inner-column elementor-element elementor-element-77cffa1\" data-id=\"77cffa1\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-15aa055 elementor-widget elementor-widget-heading\" data-id=\"15aa055\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\">Circular Cropping<\/h5>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e4d75e5 elementor-widget elementor-widget-image\" data-id=\"e4d75e5\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"942\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/elliptical_cropping.png\" class=\"attachment-full size-full wp-image-28120\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/elliptical_cropping.png 802w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/elliptical_cropping-255x300.png 255w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/elliptical_cropping-768x902.png 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Image after elliptic cropping with PIL's Image.composite<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-inner-column elementor-element elementor-element-3456ee2\" data-id=\"3456ee2\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-69492a4 elementor-widget elementor-widget-heading\" data-id=\"69492a4\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\">Rounded Rectangle<\/h5>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-52bed17 elementor-widget elementor-widget-image\" data-id=\"52bed17\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"300\" src=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/portrait_rounded_rectangle_small-300x300.png\" class=\"attachment-medium size-medium wp-image-28146\" alt=\"\" srcset=\"https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/portrait_rounded_rectangle_small-300x300.png 300w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/portrait_rounded_rectangle_small-150x150.png 150w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/portrait_rounded_rectangle_small-500x500.png 500w, https:\/\/holypython.com\/wp-content\/uploads\/2022\/10\/portrait_rounded_rectangle_small.png 733w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">Python Image with rounded rectangle cropping<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<div class=\"elementor-element elementor-element-07312bc elementor-widget elementor-widget-text-editor\" data-id=\"07312bc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>You can also use this tutorial about <a href=\"https:\/\/holypython.com\/face-recognition-on-screen-capture-with-cv2\/\">automated face recognition with Python<\/a> and merge it with Batch Cropping techniques explained in this tutorial to apply automated circular face cropping to thousands or even millions of images.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-e6df449 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e6df449\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-ae2b640\" data-id=\"ae2b640\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-74519ce elementor-widget elementor-widget-heading\" data-id=\"74519ce\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Why is it Important to Understand Geometric Shapes?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-47e5055 elementor-widget elementor-widget-text-editor\" data-id=\"47e5055\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Understanding geometric shapes is important for several reasons. Here are some examples of why it is good to understand geometric shapes:<\/p><ul><li>Geometric shapes are a fundamental building block of mathematics, and understanding them is essential for success in math and science.<\/li><li>Geometric shapes are used to represent and model many real-world objects and phenomena, such as buildings, bridges, and natural disasters.<\/li><li>Geometric shapes are used to communicate and visualize complex ideas and concepts, such as in maps, diagrams, and technical drawings.<\/li><li>Geometric shapes are used in art and design, and understanding their properties and relationships can help to create aesthetically pleasing and meaningful compositions.<\/li><li>Geometric shapes are used in many everyday applications, such as in navigation, construction, engineering, and gaming, and understanding them can help to make these tasks easier and more efficient.<\/li><\/ul><p>In summary, understanding geometric shapes is important because it is a fundamental skill that can be applied in many different areas and contexts. It can help you to better understand and solve problems, communicate and visualize ideas, and appreciate beauty and symmetry in the world around you.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-c27a064 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c27a064\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-590b7a4\" data-id=\"590b7a4\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-acd0f14 elementor-widget elementor-widget-menu-anchor\" data-id=\"acd0f14\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"summary\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b91339e elementor-widget elementor-widget-heading\" data-id=\"b91339e\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Further Resources &amp; References<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f4b53bd elementor-widget elementor-widget-text-editor\" data-id=\"f4b53bd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li>[1] International Geometry Organization:\u00a0 <a href=\"https:\/\/isgg.net\/\">International Society for Geometry and Graphics (ISGG)<\/a><\/li><li>[2] Nasa &#8211; Exploring Space Through Math: <a href=\"https:\/\/www.nasa.gov\/audience\/foreducators\/exploringmath\/geometry\/index.html\">Geometry Series<\/a><\/li><li>[3] Pillow &#8211; PIL (Python Imaging Library) Fork: <a href=\"https:\/\/pillow.readthedocs.io\/\">Documentation<\/a><\/li><li>[4] One of the most important works in the history of geometry: <a href=\"https:\/\/farside.ph.utexas.edu\/books\/Euclid\/Elements.pdf\">Euclid&#8217;s Elements<\/a> <\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-50d529a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"50d529a\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-4ddd399\" data-id=\"4ddd399\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d0c7775 elementor-widget elementor-widget-menu-anchor\" data-id=\"d0c7775\" data-element_type=\"widget\" data-widget_type=\"menu-anchor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-menu-anchor\" id=\"summary\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5b6c8c8 elementor-widget elementor-widget-heading\" data-id=\"5b6c8c8\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Summary<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-72cd607 elementor-widget elementor-widget-text-editor\" data-id=\"72cd607\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In this <a style=\"background-color: #ffffff;\" href=\"https:\/\/holypython.com\/\">Python Tutorial<\/a> we extensively covered different techniques to crop images using Python and its image editing PIL (pillow) library.<\/p><p>We took advantage of different modules from PIL such as Image, ImageDraw and ImageFont and we used several methods applied on Python PIL image objects. These methods are:<\/p><ul><li>.composite,<\/li><li>.crop<\/li><li>.draw,<\/li><li>.text,<\/li><li>.polygon,<\/li><li>.rounded_rectangle,<\/li><li>.ellipse,<\/li><li>.open<\/li><li>.show<\/li><\/ul><p>You can, of course, save these generated image objects with the .save method\u00a0 instead of just showing them with the .show method. You can refer to this quick tutorial <a href=\"https:\/\/holypython.com\/python-pil-tutorial\/how-to-open-show-and-save-images-in-python-pil\/\"><b>how to save Python images<\/b><\/a>.<\/p><p>We hope this computational photography tutorial was useful for our audience. Computational photography and digital image editing can be incredibly beneficial for organizations of all sizes and startups and they open many doors to impressive creativity.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u00a0 &lt;&lt;&lt; PIL Tutorials Create a new image Open, Show &amp; Save images (PIL) Paste, Merge, Blend images (PIL) How to Draw shapes images (PIL) How to Crop an image (PIL) How to Add Text to images (PIL) How to Add Frames to images (PIL) How to Resize an image (PIL) Brightness, Contrast, Saturation\u00a0 Convert [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":25383,"parent":16180,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"full-width.php","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-28280","page","type-page","status-publish","has-post-thumbnail","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/pages\/28280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/comments?post=28280"}],"version-history":[{"count":3,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/pages\/28280\/revisions"}],"predecessor-version":[{"id":31672,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/pages\/28280\/revisions\/31672"}],"up":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/pages\/16180"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media\/25383"}],"wp:attachment":[{"href":"https:\/\/holypython.com\/wp-json\/wp\/v2\/media?parent=28280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}