

{"id":82399,"date":"2020-09-17T11:51:28","date_gmt":"2020-09-17T06:21:28","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=82399"},"modified":"2026-06-01T11:46:09","modified_gmt":"2026-06-01T06:16:09","slug":"cartoonify-image-opencv-python","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/","title":{"rendered":"Cartoonify an Image with OpenCV in Python"},"content":{"rendered":"<p>Do you miss your childhood? Yes, everyone does.! So today let&#8217;s head towards giving our pictures some cartoonic effects. This article is all about building a photo cartoonifyer using Python and OpenCV<\/p>\n<h3>What is OpenCV?<\/h3>\n<p>Python is the pool of libraries. It has numerous libraries for real-world applications. One such library is OpenCV. OpenCV is a cross-platform library used for Computer Vision. It includes applications like video and image capturing and processing. It is majorly used in image transformation, object detection, face recognition, and many other stunning applications.<\/p>\n<h3>What are we going to build?<\/h3>\n<p>At the end of this article, we aim to transform images into its cartoon. Yes, we will CARTOONIFY the images. Thus, we will build a python application that will transform an image into its cartoon using OpenCV.<\/p>\n<p>We aim to build an application which looks like:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82404\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output.png\" alt=\"cartoonifier output\" width=\"1366\" height=\"672\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-1024x504.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-768x378.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-520x256.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82405\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image.png\" alt=\"cartoonifier save image\" width=\"1366\" height=\"711\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-300x156.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-1024x533.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-520x271.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<p>Let\u2019s head toward creating something CREATIVE.<\/p>\n<p><strong>Original Image:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/original.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82406\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/original.png\" alt=\"original image\" width=\"1366\" height=\"678\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/original.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/original-300x149.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/original-1024x508.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/original-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/original-768x381.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/original-520x258.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h3>Steps to develop Image Cartoonifier<\/h3>\n<h3>Download Image Cartoonifies Code<\/h3>\n<p>Please download source code of Image Cartoonfier Project: <a href=\"https:\/\/drive.google.com\/file\/d\/1OlVWRY_GkuQTL4QQcpu_X8dhj553h3PZ\/view?usp=drive_link\"><strong>Cartoonify an Image in Python<\/strong><\/a><\/p>\n<h4>1: Importing the required modules<\/h4>\n<p>We will import the following modules:<\/p>\n<ul>\n<li>CV2: Imported to use OpenCV for image processing<\/li>\n<li>easygui: Imported to open a file box. It allows us to select any file from our system.<\/li>\n<li>Numpy: Images are stored and processed as numbers. These are taken as arrays. We use NumPy to deal with arrays.<\/li>\n<li>Imageio: Used to read the file which is chosen by file box using a path.<\/li>\n<li>Matplotlib: This library is used for visualization and plotting. Thus, it is imported to form the plot of images.<\/li>\n<li>OS: For OS interaction. Here, to read the path and save images to that path.<\/li>\n<\/ul>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import cv2 #for image processing\r\nimport easygui #to open the filebox\r\nimport numpy as np #to store image\r\nimport imageio #to read image stored at particular path\r\nimport sys\r\nimport matplotlib.pyplot as plt\r\nimport os\r\nimport tkinter as tk\r\nfrom tkinter import filedialog\r\nfrom tkinter import *\r\nfrom PIL import ImageTk, Image\r\n<\/pre>\n<h4>2: Building a File Box to choose a particular file<\/h4>\n<p>In this step, we will build the main window of our application, where the buttons, labels, and images will reside. We also give it a title by title() function.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\"\"\" fileopenbox opens the box to choose file\r\nand help us store file path as string \"\"\"\r\ndef upload():\r\n    ImagePath=easygui.fileopenbox()\r\n    cartoonify(ImagePath)\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>The above code opens the file box, i.e the pop-up box to choose the file from the device, which opens every time you run the code. fileopenbox() is the method in easyGUI module which returns the path of the chosen file as a string.<\/p>\n<p><em><strong>NOTE:<\/strong><\/em> Now, all the operation will be done on the button click, thus all the below steps are the part of function cartoonify (ImagePath)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def cartoonify(ImagePath):<\/pre>\n<h4>3: How is an image stored?<\/h4>\n<p>Now, just think, how will a program read an image? For a computer, everything is just numbers. Thus, in the below code, we will convert our image into a numpy array.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#read the image\r\n    originalmage = cv2.imread(ImagePath)\r\n    originalmage = cv2.cvtColor(originalmage, cv2.COLOR_BGR2RGB)\r\n#print(image)  # image is stored in form of numbers\r\n\r\n# confirm that image is chosen\r\n    if originalmage is None:\r\n        print(\"Can not find any image. Choose appropriate file\")\r\n        sys.exit()\r\n\r\n    ReSized1 = cv2.resize(originalmage, (960, 540))\r\n#plt.imshow(ReSized1, cmap='gray')\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>Imread is a method in cv2 which is used to store images in the form of numbers. This helps us to perform operations according to our needs. The image is read as a numpy array, in which cell values depict R, G, and B values of a pixel.<\/p>\n<p><em><strong>NOTE:<\/strong><\/em> We resize the image after each transformation to display all the images on a similar scale at last.<\/p>\n<p><strong>Beginning with image transformations:<\/strong><\/p>\n<p>To convert an image to a cartoon, multiple transformations are done. Firstly, an image is converted to a Grayscale image. Yes, similar to the old day&#8217;s pictures.! Then, the Grayscale image is smoothened, and we try to extract the edges in the image. Finally, we form a color image and mask it with edges. This creates a beautiful cartoon image with edges and lightened color of the original image.<\/p>\n<p>Let\u2019s start with these transformations to convert an image to its cartoon image.<\/p>\n<h4>4: Transforming an image to grayscale<\/h4>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#converting an image to grayscale\r\ngrayScaleImage = cv2.cvtColor(originalmage, cv2.COLOR_BGR2GRAY)\r\nReSized2 = cv2.resize(grayScaleImage, (960, 540))\r\n#plt.imshow(ReSized2, cmap='gray')\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>cvtColor(image, flag) is a method in cv2 which is used to transform an image into the colour-space mentioned as \u2018flag\u2019. Here, our first step is to convert the image into grayscale. Thus, we use the BGR2GRAY flag. This returns the image in grayscale. A grayscale image is stored as grayScaleImage.<\/p>\n<p>After each transformation, we resize the resultant image using the resize() method in cv2 and display it using imshow() method. This is done to get more clear insights into every single transformation step.<\/p>\n<p>The above code will generate the following output:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/gray-image.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82407\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/gray-image.png\" alt=\"gray image\" width=\"1366\" height=\"672\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/gray-image.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/gray-image-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/gray-image-1024x504.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/gray-image-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/gray-image-768x378.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/gray-image-520x256.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h4>5: Smoothening a grayscale image<\/h4>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#applying median blur to smoothen an image\r\nsmoothGrayScale = cv2.medianBlur(grayScaleImage, 5)\r\nReSized3 = cv2.resize(smoothGrayScale, (960, 540))\r\n#plt.imshow(ReSized3, cmap='gray')\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>To smoothen an image, we simply apply a blur effect. This is done using medianBlur() function. Here, the center pixel is assigned a mean value of all the pixels which fall under the kernel. In turn, creating a blur effect.<\/p>\n<p>The above code generates the following output:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/smooth-gray.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82408\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/smooth-gray.png\" alt=\"smooth gray\" width=\"1366\" height=\"672\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/smooth-gray.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/smooth-gray-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/smooth-gray-1024x504.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/smooth-gray-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/smooth-gray-768x378.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/smooth-gray-520x256.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h4>6: Retrieving the edges of an image<\/h4>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#retrieving the edges for cartoon effect\r\n#by using thresholding technique\r\ngetEdge = cv2.adaptiveThreshold(smoothGrayScale, 255, \r\n  cv2.ADAPTIVE_THRESH_MEAN_C, \r\n  cv2.THRESH_BINARY, 9, 9)\r\n\r\nReSized4 = cv2.resize(getEdge, (960, 540))\r\n#plt.imshow(ReSized4, cmap='gray')\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>Cartoon effect has two specialties:<\/p>\n<ol>\n<li>Highlighted Edges<\/li>\n<li>Smooth colors<\/li>\n<\/ol>\n<p>In this step, we will work on the first specialty. Here, we will try to retrieve the edges and highlight them. This is attained by the adaptive thresholding technique. The threshold value is the mean of the neighborhood pixel values area minus the constant C. C is a constant that is subtracted from the mean or weighted sum of the neighborhood pixels. Thresh_binary is the type of threshold applied, and the remaining parameters determine the block size.<\/p>\n<p>The above code will generate output like below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/edge-image.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82409\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/edge-image.png\" alt=\"edge image\" width=\"1366\" height=\"675\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/edge-image.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/edge-image-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/edge-image-1024x506.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/edge-image-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/edge-image-768x380.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/edge-image-520x257.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h4>7: Preparing a Mask Image<\/h4>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#applying bilateral filter to remove noise \r\n#and keep edge sharp as required\r\ncolorImage = cv2.bilateralFilter(originalmage, 9, 300, 300)\r\nReSized5 = cv2.resize(colorImage, (960, 540))\r\n#plt.imshow(ReSized5, cmap='gray')\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>In the above code, we finally work on the second specialty. We prepare a lightened color image that we mask with edges at the end to produce a cartoon image. We use bilateralFilter which removes the noise. It can be taken as smoothening of an image to an extent.<\/p>\n<p>The third parameter is the diameter of the pixel neighborhood, i.e, the number of pixels around a certain pixel which will determine its value. The fourth and Fifth parameter defines signmaColor and sigmaSpace. These parameters are used to give a sigma effect, i.e make an image look vicious and like water paint, removing the roughness in colors.<\/p>\n<p>Yes, it\u2019s similar to BEAUTIFY or AI effect in cameras of modern mobile phones.<\/p>\n<p>The above code generates the following output:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/color-mask.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82410\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/color-mask.png\" alt=\"color mask\" width=\"1366\" height=\"675\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/color-mask.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/color-mask-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/color-mask-1024x506.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/color-mask-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/color-mask-768x380.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/color-mask-520x257.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h4>8: Giving a Cartoon Effect<\/h4>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#masking edged image with our \"BEAUTIFY\" image\r\ncartoonImage = cv2.bitwise_and(colorImage, colorImage, mask=getEdge)\r\n\r\nReSized6 = cv2.resize(cartoonImage, (960, 540))\r\n#plt.imshow(ReSized6, cmap='gray')\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>So, let&#8217;s combine the two specialties. This will be done using MASKING. We perform bitwise and on two images to mask them. Remember, images are just numbers?<\/p>\n<p>Yes, so that\u2019s how we mask edged image on our \u201cBEAUTIFY\u201d image.<\/p>\n<p>This finally CARTOONIFY our image!<\/p>\n<p>The above code will generate output like below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoon-effect.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82411\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoon-effect.png\" alt=\"cartoon effect\" width=\"1366\" height=\"675\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoon-effect.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoon-effect-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoon-effect-1024x506.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoon-effect-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoon-effect-768x380.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoon-effect-520x257.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h4>9: Plotting all the transitions together<\/h4>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># Plotting the whole transition\r\nimages=[ReSized1, ReSized2, ReSized3, ReSized4, ReSized5, ReSized6]\r\nfig, axes = plt.subplots(3,2, figsize=(8,8), subplot_kw={'xticks':[], 'yticks':[]}, gridspec_kw=dict(hspace=0.1, wspace=0.1))\r\nfor i, ax in enumerate(axes.flat):\r\n    ax.imshow(images[i], cmap='gray')\r\n\/\/save button code\r\nplt.show()\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>To plot all the images, we first make a list of all the images. The list here is named \u201cimages\u201d and contains all the resized images. Now, we create axes like subl=plots in a plot and display one-one images in each block on the axis using imshow() method.<\/p>\n<p>plt.show() plots the whole plot at once after we plot on each subplot.<\/p>\n<p>The above code will generate output like below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82404\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output.png\" alt=\"cartoonifier output\" width=\"1366\" height=\"672\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-1024x504.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-768x378.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-output-520x256.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h4>10: Functionally of save button<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def save(ReSized6, ImagePath):\r\n    #saving an image using imwrite()\r\n    newName=\"cartoonified_Image\"\r\n    path1 = os.path.dirname(ImagePath)\r\n    extension=os.path.splitext(ImagePath)[1]\r\n    path = os.path.join(path1, newName+extension)\r\n    cv2.imwrite(path, cv2.cvtColor(ReSized6, cv2.COLOR_RGB2BGR))\r\n    I = \"Image saved by name \" + newName +\" at \"+ path\r\n    tk.messagebox.showinfo(title=None, message=I)\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>Here, the idea is to save the resultant image. For this, we take the old path, and just change the tail (name of the old file) to a new name and store the cartoonified image with a new name in the same folder by appending the new name to the head part of the file.<\/p>\n<p>For this, we extract the head part of the file path by os.path.dirname() method. Similarly, os.path.splitext(ImagePath)[1] is used to extract the extension of the file from the path.<\/p>\n<p>Here, newName stores \u201cCartoonified_Image\u201d as the name of a new file. os.path.join(path1, newName + extension) joins the head of path to the newname and extension. This forms the complete path for the new file.<\/p>\n<p>imwrite() method of cv2 is used to save the file at the path mentioned. cv2.cvtColor(ReSized6, cv2.COLOR_RGB2BGR) is used to assure that no color get extracted or highlighted while we save our image. Thus, at last, the user is given confirmation that the image is saved with the name and path of the file.<\/p>\n<p>Once executed with button, this function will result in below output:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82405\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image.png\" alt=\"cartoonifier save image\" width=\"1366\" height=\"711\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-300x156.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-1024x533.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonifier-save-image-520x271.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h4>11: Making the main window<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">top=tk.Tk()\r\ntop.geometry('400x400')\r\ntop.title('Cartoonify Your Image !')\r\ntop.configure(background='white')\r\nlabel=Label(top,background='#CDCDCD', font=('calibri',20,'bold'))\r\n<\/pre>\n<h4>12: Making the Cartoonify button in the main window<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">upload=Button(top,text=\"Cartoonify an Image\",command=upload,padx=10,pady=5)\r\nupload.configure(background='#364156', foreground='white',font=('calibri',10,'bold'))\r\nupload.pack(side=TOP,pady=50)\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/box.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82413\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/box.png\" alt=\"box\" width=\"1366\" height=\"708\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/box.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/box-300x155.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/box-1024x531.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/box-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/box-768x398.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/box-520x270.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h4>13: Making a Save button in the main window<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">save1=Button(top,text=\"Save cartoon image\",command=lambda: save(ImagePath, ReSized6),padx=30,pady=5)\r\nsave1.configure(background='#364156', foreground='white',font=('calibri',10,'bold'))\r\nsave1.pack(side=TOP,pady=50)\r\n<\/pre>\n<p>The above code makes a button as soon as the image transformation is done. It gives an option to the user to save cartoonified image.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/save.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82414\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/save.png\" alt=\"save\" width=\"1366\" height=\"699\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/save.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/save-300x154.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/save-1024x524.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/save-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/save-768x393.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/save-520x266.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h4>14: Main function to build the tkinter window<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">top.mainloop()<\/pre>\n<p><strong>The Final Result:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/image-Save.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-82415\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/image-Save.png\" alt=\"image Save\" width=\"1366\" height=\"672\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/image-Save.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/image-Save-300x148.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/image-Save-1024x504.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/image-Save-150x74.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/image-Save-768x378.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/image-Save-520x256.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>Turning a real photo into a cartoon is fun and popular in image editing. With Python and OpenCV, we can build a project that cartoonifies an image in just a few steps. This uses basic image processing techniques, not deep learning. It\u2019s a great starting point for beginners who want to learn OpenCV and how images are handled by computers.<\/p>\n<p>We have successfully developed Image Cartoonifier with OpenCV in Python. This is the magic of openCV which let us do miracles. We suggest you make a photo editor of your own and try different effects.<\/p>\n<p>This project is creative and easy to try with your own photos. It teaches key skills like reading images, applying filters, using edge detection, and color space changes in OpenCV. You can build a simple GUI where users can upload and cartoonify images. It\u2019s fun for school projects, social media apps, or just learning computer vision basics with Python.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2492,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1OlVWRY_GkuQTL4QQcpu_X8dhj553h3PZ\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601061807\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1OlVWRY_GkuQTL4QQcpu_X8dhj553h3PZ\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-01 07:59:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-04 20:17:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-08 06:44:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-11 07:14:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-14 11:16:49&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-14 11:16:49&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you miss your childhood? Yes, everyone does.! So today let&#8217;s head towards giving our pictures some cartoonic effects. This article is all about building a photo cartoonifyer using Python and OpenCV What is&#46;&#46;&#46;<\/p>\n","protected":false},"author":10,"featured_media":82545,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[23294,21686,20697,23025,21082],"class_list":["post-82399","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-cartoonify-image","tag-deep-learning-project","tag-machine-learning-project","tag-opencv-project","tag-python-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Cartoonify an Image with OpenCV in Python - DataFlair<\/title>\n<meta name=\"description\" content=\"Cartoonify Image with Python and OpenCV - Develop an interesting Machine Learning project to convert image to cartoon with Python, OpenCV, NumPy\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cartoonify an Image with OpenCV in Python - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Cartoonify Image with Python and OpenCV - Develop an interesting Machine Learning project to convert image to cartoon with Python, OpenCV, NumPy\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-17T06:21:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T06:16:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonify-an-image-opencv-python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cartoonify an Image with OpenCV in Python - DataFlair","description":"Cartoonify Image with Python and OpenCV - Develop an interesting Machine Learning project to convert image to cartoon with Python, OpenCV, NumPy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/","og_locale":"en_US","og_type":"article","og_title":"Cartoonify an Image with OpenCV in Python - DataFlair","og_description":"Cartoonify Image with Python and OpenCV - Develop an interesting Machine Learning project to convert image to cartoon with Python, OpenCV, NumPy","og_url":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-09-17T06:21:28+00:00","article_modified_time":"2026-06-01T06:16:09+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonify-an-image-opencv-python.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33"},"headline":"Cartoonify an Image with OpenCV in Python","datePublished":"2020-09-17T06:21:28+00:00","dateModified":"2026-06-01T06:16:09+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/"},"wordCount":1528,"commentCount":21,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonify-an-image-opencv-python.jpg","keywords":["cartoonify image","deep learning project","machine learning project","opencv project","Python project"],"articleSection":["Machine Learning Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/","url":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/","name":"Cartoonify an Image with OpenCV in Python - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonify-an-image-opencv-python.jpg","datePublished":"2020-09-17T06:21:28+00:00","dateModified":"2026-06-01T06:16:09+00:00","description":"Cartoonify Image with Python and OpenCV - Develop an interesting Machine Learning project to convert image to cartoon with Python, OpenCV, NumPy","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonify-an-image-opencv-python.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/09\/cartoonify-an-image-opencv-python.jpg","width":1200,"height":628,"caption":"cartoonify an image opencv python"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/cartoonify-image-opencv-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Machine Learning Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/machine-learning\/"},{"@type":"ListItem","position":3,"name":"Cartoonify an Image with OpenCV in Python"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team is passionate about delivering top-notch tutorials and resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With expertise in the tech industry, we simplify complex topics to help learners excel. Stay updated with our latest insights.","url":"https:\/\/data-flair.training\/blogs\/author\/dfadteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/82399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=82399"}],"version-history":[{"count":8,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/82399\/revisions"}],"predecessor-version":[{"id":148560,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/82399\/revisions\/148560"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/82545"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=82399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=82399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=82399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}