Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8a44dd9

Browse files
Merge pull request avinashkranjan#1786 from Kalivarapubindusree/olam
GIF Creator Added
2 parents 60ec276 + 9883cdc commit 8a44dd9

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

‎GIF/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**GIF_Creator**
2+
3+
4+
5+
**How_To_Run**
6+
7+
First of all, we need to import (Image,PIL)libraries into our code. And for running Python3 is needed! then run ( Python3 gifnew.py ) it from terminal r Visual Studio!
8+
9+
![gif py - Visual Studio Code 11-06-2023 15_38_37](https://github.com/Kalivarapubindusree/Amazing-Python-Scripts/assets/114821855/c74f4a42-dc49-4d68-9243-70db90ef4493)
10+
11+
12+
13+
14+
**conclusion:**
15+
16+
It is useful to Create GIF From the Given Images.

‎GIF/gifnew.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from PIL import Image
2+
import glob
3+
4+
def convert_to_gif(image_folder, gif_name, duration):
5+
images = glob.glob(image_folder + "/*.jpg") # Change the file extension if necessary
6+
7+
frames = []
8+
for image in images:
9+
with Image.open(image) as img:
10+
frames.append(img.convert("RGBA"))
11+
12+
frames[0].save(gif_name, format="GIF", append_images=frames[1:], save_all=True, duration=duration, loop=0)
13+
print("GIF created successfully!")
14+
15+
def main():
16+
image_folder = "Image-Slideshow" # Path to the folder containing the images
17+
gif_name = "output.gif" # Name of the output GIF file
18+
duration = 500 # Duration between frames in milliseconds
19+
20+
convert_to_gif(image_folder, gif_name, duration)
21+
22+
if __name__ == "__main__":
23+
main()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /