{"id":86063,"date":"2022-03-18T09:00:12","date_gmt":"2022-03-18T03:30:12","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=86063"},"modified":"2026-06-03T15:40:16","modified_gmt":"2026-06-03T10:10:16","slug":"python-gif-creator","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/","title":{"rendered":"Python GIF Creator &#8211; Convert Video to GIF"},"content":{"rendered":"<p>GIF Creator is an application that converts a video into gif. A gif is a video without audio and goes on into an infinite loop. python GIF creator project is a beginner level project which will need some libraries and little concepts of Python. So let\u2019s create GIF using Python.<\/p>\n<h3>What is a GIF Creator?<\/h3>\n<p>A GIF Creator is an application that creates a GIF. This GIF is made through a video, an image or it can be an animation. Here in this project, we will be using a video and creating a GIF from it. The video is turned into an infinite loop without audio.<\/p>\n<h3>Python GIF Project Details<\/h3>\n<p>In this project, we will be building a GUI Window using Tkinter Module. In the window, there will be a browsing field from where the user will browse a video that needs to be converted into a GIF. There will be a Button which will convert the selected video into GIF.<\/p>\n<p>We are going to use moviepy.editor library to make a gif using a video file.<\/p>\n<h3>Project Prerequisites<\/h3>\n<p>To create this project, we will have to install the following modules:<\/p>\n<ul>\n<li>Tkinter Module<\/li>\n<li>Moviepy Module<\/li>\n<li>Os Module<\/li>\n<\/ul>\n<h3>Download Python GIF Creator Code<\/h3>\n<p>Please download the source code of Python GIF Creator Project from the following link: <a href=\"https:\/\/drive.google.com\/file\/d\/1U_G-waX1jTgw8NVGkEr7z1m8zZIf5dme\/view?usp=drive_link\"><strong>GIF Creator Project Code<\/strong><\/a><\/p>\n<h3>Steps to Create Python Project of GIF creation<\/h3>\n<p>Let\u2019s have a look at the steps to create python gif creator.<\/p>\n<ol>\n<li>Importing the Required Libraries and Modules<\/li>\n<li>Creating GUI<\/li>\n<li>Browsing A Video File<\/li>\n<li>Creating the GIF<\/li>\n<\/ol>\n<p>Let us look at each step in detail.<\/p>\n<h4>1. Importing the Required Libraries and Modules:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#import libraries\r\nfrom moviepy.editor import *\r\nfrom tkinter import *\r\nimport tkinter as tk\r\n<\/pre>\n<ul>\n<li><strong>Tkinter Module<\/strong> &#8211; Tkinter Module is used to create the GUI of the python gif creator project. Here we have imported the module as tk so we can use the abbreviation later in the code.<\/li>\n<li><strong>Moviepy Module<\/strong> &#8211; Moviepy.editor is used to edit and play with video files. In this project, we will be using this to take in a video file and convert it into a gif.<\/li>\n<li><strong>OS Module<\/strong> &#8211; Os Module stands for Operating System Module. Here we are going to use this module to fetch the name of the file from its path.<\/li>\n<\/ul>\n<h4>2. Creating the GUI:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">window = Tk()#creating window\r\nwindow.geometry('700x300')#geometry of window\r\nwindow.title('TechVidvan')#title to window\r\nLabel(window,text=\"Let's make a GIF\",font=('bold',20)).pack()#label\r\n<\/pre>\n<ul>\n<li><strong>Tk()<\/strong> &#8211; Using the Tk() method we are going to create a GUI window<\/li>\n<li><strong>geometry()<\/strong> &#8211; This method specifies the size of our GUI Window.<\/li>\n<li><strong>title()<\/strong> &#8211; This method helps us give a title to the window.<\/li>\n<li><strong>Label()<\/strong> &#8211; A Label is a widget on our window that might display a text. We are using the Label() method to create a label widget on our window. This will help us display a text. We can also change the font, size, foreground color, background color etc of this label.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Label(window,text='Select a File').pack()\r\nButton(window,text='Browse',command=browseFiles).pack()#button field\r\nButton(window,text='Create a Gif').pack()#button field\r\n<\/pre>\n<ul>\n<li><strong>Button()<\/strong> &#8211; Using this function, we created a button on our window. We have created 2 buttons &#8211; For Browsing the File and For Converting it into GIF<\/li>\n<li><strong>pack()<\/strong> &#8211; To display all the widgets on the window, we have used the pack() method. Pack() is an automated method that displays the widgets without x and y coordinates specification.<\/li>\n<\/ul>\n<h4>3. Browsing a Video File<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def browseFiles():\r\n    global filepath\r\n    filename = filedialog.askopenfilenames(title='select', filetypes=[\r\n                    (\"all video format\", \".mov\"),\r\n                    (\"all video format\", \".flv\"),\r\n                    (\"all video format\", \".avi\"),\r\n                ])\r\n    filepath=os.path.basename(filename)\r\n<\/pre>\n<ul>\n<li>We have created a function to browse the video file that needs to be converted into gif.<\/li>\n<li>We make a global variable filepath. This variable is accessible outside the function too.<\/li>\n<li>askopenfilenames() &#8211; Using this method we create a dialog box from where the user can browse a file. Inside it, we have specified the file types and given extensions of only video files. This will save the path of the file in the variable &#8211; filename.<\/li>\n<li>os.path.basename() &#8211; This extracts the filename from the filepath.<\/li>\n<\/ul>\n<h4>4. Creating a GIF<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def create_gif():\r\n    clip = VideoFileClip(filepath)\r\n    clip.write_gif(\"mygif.gif\")#making a gif\r\n<\/pre>\n<p>VideoFileClip() &#8211; Using the VideoFileClip(), we load the video file that is saved in the filepath variable.<\/p>\n<p>write_gif() &#8211; This takes in the video file and converts it into a gif.<\/p>\n<h3>Python GIF Creator Output<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/python-gif-creator-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-86082\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/python-gif-creator-output.webp\" alt=\"python gif creator output\" width=\"698\" height=\"330\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>We have successfully created the video to GIF Creator Project using python with GUI. We have used the following two modules-<\/p>\n<ul>\n<li>Tkinter Module<\/li>\n<li>Moviepy Module<\/li>\n<li>Os Module<\/li>\n<\/ul>\n<p>Now we can convert a video into a gif.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GIF Creator is an application that converts a video into gif. A gif is a video without audio and goes on into an infinite loop. python GIF creator project is a beginner level project&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":86083,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1053],"tags":[3331,4688,4689,4690,4691,483,3249,4692],"class_list":["post-86063","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-beginner-python-projects","tag-create-gif-using-python","tag-python-gif-creator","tag-python-gif-project","tag-python-gif-project-with-source-code","tag-python-project","tag-python-project-for-beginners","tag-python-video-to-gif"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python GIF Creator - Convert Video to GIF - TechVidvan<\/title>\n<meta name=\"description\" content=\"Create GIF from video in this Python project using modules like Tkinter for GUI, Moviepy to edit &amp; play with video &amp; OS to fetch name of file\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python GIF Creator - Convert Video to GIF - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Create GIF from video in this Python project using modules like Tkinter for GUI, Moviepy to edit &amp; play with video &amp; OS to fetch name of file\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-18T03:30:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-03T10:10:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2022\/03\/python-create-animated-gif.webp\" \/>\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\/webp\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python GIF Creator - Convert Video to GIF - TechVidvan","description":"Create GIF from video in this Python project using modules like Tkinter for GUI, Moviepy to edit & play with video & OS to fetch name of file","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:\/\/techvidvan.com\/tutorials\/python-gif-creator\/","og_locale":"en_US","og_type":"article","og_title":"Python GIF Creator - Convert Video to GIF - TechVidvan","og_description":"Create GIF from video in this Python project using modules like Tkinter for GUI, Moviepy to edit & play with video & OS to fetch name of file","og_url":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2022-03-18T03:30:12+00:00","article_modified_time":"2026-06-03T10:10:16+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2022\/03\/python-create-animated-gif.webp","type":"image\/webp"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Python GIF Creator &#8211; Convert Video to GIF","datePublished":"2022-03-18T03:30:12+00:00","dateModified":"2026-06-03T10:10:16+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/"},"wordCount":693,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2022\/03\/python-create-animated-gif.webp","keywords":["beginner python projects","create GIF using Python","python gif creator","Python GIF Project","Python GIF Project with source code","Python project","python project for beginners","python video to gif"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/","url":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/","name":"Python GIF Creator - Convert Video to GIF - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2022\/03\/python-create-animated-gif.webp","datePublished":"2022-03-18T03:30:12+00:00","dateModified":"2026-06-03T10:10:16+00:00","description":"Create GIF from video in this Python project using modules like Tkinter for GUI, Moviepy to edit & play with video & OS to fetch name of file","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2022\/03\/python-create-animated-gif.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2022\/03\/python-create-animated-gif.webp","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/python-gif-creator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Python GIF Creator &#8211; Convert Video to GIF"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/86063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=86063"}],"version-history":[{"count":2,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/86063\/revisions"}],"predecessor-version":[{"id":448106,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/86063\/revisions\/448106"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/86083"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=86063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=86063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=86063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}