TGViewer
Channel Public Channel
Python Projects & Free Books

Python Projects & Free Books

@pythonfreebootcamp

Python Interview Projects & Free Courses

Admin: @Coderfun
Subscribers
40.6K
Photos
655
Videos
1
Links
301

Showing posts older than #209 ยท Back to latest

Older Posts 17 shown
Post #204 13.1K
  • ๐Ÿ‘ 7
Post #202 11.8K
Mastering Python Networking

๐Ÿ““ Book
  • ๐Ÿ‘ 11
  • ๐Ÿ‘Ž 1
Post #200 10.5K
Python Libraries and Frameworks
  • ๐Ÿ‘ 11
Post #197 10.5K
How to convert image to pdf in Python

# Python3 program to convert image to pfd
# using img2pdf library
 
# importing necessary libraries
import img2pdf
from PIL import Image
import os
 
# storing image path
img_path = "Input.png"
 
# storing pdf path
pdf_path = "file_pdf.pdf"
 
# opening image
image = Image.open(img_path)
 
# converting into chunks using img2pdf
pdf_bytes = img2pdf.convert(image.filename)
 
# opening or creating pdf file
file = open(pdf_path, "wb")
 
# writing pdf files with chunks
file.write(pdf_bytes)
 
# closing image file
image.close()
 
# closing pdf file
file.close()
 
# output
print("Successfully made pdf file")

pip3 install pillow && pip3 install img2pdf
  • ๐Ÿ‘ 29
  • ๐Ÿ‘Ž 1
Post #190 8.9K
  • ๐Ÿ‘ 10
Post #189 8.98K
  • ๐Ÿ‘ 7
Post #188 9K
  • ๐Ÿ‘ 7
Post #183 10.8K
Python code To download from Youtube โš™

from pytube import YouTube

# Enter the YouTube video URL
url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

# Create a YouTube object with the URL
yt = YouTube(url)

# Select the highest resolution video
video = yt.streams.get_highest_resolution()

# Set the output directory and filename
output_dir = "/storage/emulated/0/Documents/"
filename = yt.title+".mp4"

# Download the video
video.download(output_dir, filename)

print(f"Download complete: {filename}")
  • ๐Ÿ‘ 10
Older posts โ†’
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’