深圳住房和建设局官网网站,建设银行论坛网站,重庆建筑工程网,重庆seo招聘01、 图片优化器
使用这个很棒的自动化脚本#xff0c;可以帮助把图像处理的更好#xff0c;你可以像在 Photoshop 中一样编辑它们。
该脚本使用流行的是 Pillow 模块
# Image Optimizing
# pip install Pillow
import PIL
# Croping
im PIL.Image.open(Image1.jp…01、 图片优化器
使用这个很棒的自动化脚本可以帮助把图像处理的更好你可以像在 Photoshop 中一样编辑它们。
该脚本使用流行的是 Pillow 模块
# Image Optimizing
# pip install Pillow
import PIL
# Croping
im PIL.Image.open(Image1.jpg)
im im.crop((34, 23, 100, 100))
# Resizing
im PIL.Image.open(Image1.jpg)
im im.resize((50, 50))
# Flipping
im PIL.Image.open(Image1.jpg)
im im.transpose(PIL.Image.FLIP_LEFT_RIGHT)
# Rotating
im PIL.Image.open(Image1.jpg)
im im.rotate(360)
# Compressing
im PIL.Image.open(Image1.jpg)
im.save(Image1.jpg, optimizeTrue, quality90)
# Bluring
im PIL.Image.open(Image1.jpg)
im im.filter(PIL.ImageFilter.BLUR)
# Sharpening
im PIL.Image.open(Image1.jpg)
im im.filter(PIL.ImageFilter.SHARPEN)
# Set Brightness
im PIL.Image.open(Image1.jpg)
im PIL.ImageEnhance.Brightness(im)
im im.enhance(1.5)
# Set Contrast
im PIL.Image.open(Image1.jpg)
im PIL.ImageEnhance.Contrast(im)
im im.enhance(1.5)
# Adding Filters
im PIL.Image.open(Image1.jpg)
im PIL.ImageOps.grayscale(im)
im PIL.ImageOps.invert(im)
im PIL.ImageOps.posterize(im, 4)
# Saving
im.save(Image1.jpg)02、视频优化器
通过使用以下自动化脚本你不仅可以使用 Python 来优化视频还可以使用它来优化图像。该脚本使用 Moviepy 模块允许你修剪、添加音频、设置视频速度、添加 VFX 等等。
# Video Optimizer
# pip install moviepy
import moviepy.editor as pyedit
# Load the Video
video pyedit.VideoFileClip(vid.mp4)
# Trimming
vid1 video.subclip(0, 10)
vid2 video.subclip(20, 40)
final_vid pyedit.concatenate_videoclips([vid1, vid2])
# Speed up the video
final_vid final_vid.speedx(2)
# Adding Audio to the video
aud pyedit.AudioFileClip(bg.mp3)
final_vid final_vid.set_audio(aud)
# Reverse the Video
final_vid final_vid.fx(pyedit.vfx.time_mirror)
# Merge two videos
vid1 pyedit.VideoFileClip(vid1.mp4)
vid2 pyedit.VideoFileClip(vid2.mp4)
final_vid pyedit.concatenate_videoclips([vid1, vid2])
# Add VFX to Video
vid1 final_vid.fx(pyedit.vfx.mirror_x)
vid2 final_vid.fx(pyedit.vfx.invert_colors)
final_vid pyedit.concatenate_videoclips([vid1, vid2])
# Add Images to Video
img1 pyedit.ImageClip(img1.jpg)
img2 pyedit.ImageClip(img2.jpg)
final_vid pyedit.concatenate_videoclips([img1, img2])
# Save the video
final_vid.write_videofile(final.mp4)03、PDF 转图片
这个小型自动化脚本可以方便地获取整个 PDF 页面并将它们转换为图像。该脚本使用流行的 PyMuPDF 模块该模块以其 PDF 文本提取而闻名。
# PDF to Images
# pip install PyMuPDF
import fitz
def pdf_to_images(pdf_file):doc fitz.open(pdf_file)for p in doc:pix p.get_pixmap()output fpage{p.number}.pngpix.writePNG(output)
pdf_to_images(test.pdf)04、获取 API 数据
需要从数据库中获取 API 数据或需要向服务器发送 API 请求。那么这个自动化脚本对你来说是一个方便的工具。使用 Urllib3 模块可让你获取和发布 API 请求。
# pip install urllib3
import urllib3
# Fetch API data
url https://api.github.com/users/psf/repos
http urllib3.PoolManager()
response http.request(GET, url)
print(response.status)
print(response.data)
# Post API data
url https://httpbin.org/post
http urllib3.PoolManager()
response http.request(POST, url, fields{hello: world})
print(response.status)05、电池指示灯
这个方便的脚本可以让你设置你想要得到通知的电池百分比该脚本使用 Pyler 进行通知使用 Psutil 获取当前的电池百分比。
# Battery Notifier
# pip instal plyer
from plyer import notification
import psutil
from time import sleep
while True:battery psutil.sensors_battery()life battery.percentif life 50:notification.notify(title Battery Low,message Please connect to power source,timeout 10)sleep(60)06、语法固定器
厌倦了校对你的长文章或文本然后你可以试试这个自动化脚本它将扫描你的文本并纠正语法错误这个很棒的脚本使用 Happtransformer 模块这是一个机器学习模块经过训练可以修复文本中的语法错误。
# Grammer Fixer
# pip install happytransformer
from happytransformer import HappyTextToText as HappyTTT
from happytransformer import TTSettings
def Grammer_Fixer(Text):Grammer HappyTTT(T5,prithivida/grammar_error_correcter_v1)config TTSettings(do_sampleTrue, top_k10, max_length100)corrected Grammer.generate_text(Text, argsconfig)print(Corrected Text: , corrected.text)
Text This is smple tet we how know this
Grammer_Fixer(Text)07、拼写修正
这个很棒的脚本将帮助你纠正你的文本单词拼写错误。你可以在下面找到脚本将告诉你如何修复句子中的单个单词或多个单词。
# Spell Fixer
# pip install textblob
from textblob import *
# Fixing Paragraph Spells
def fix_paragraph_words(paragraph):sentence TextBlob(paragraph)correction sentence.correct()print(correction)
# Fixing Words Spells
def fix_word_spell(word):word Word(word)correction word.correct()print(correction)
fix_paragraph_words(This is sammple tet!!)
fix_word_spell(maangoo)08、互联网下载器
你们可能使用下载软件从 Internet 下载照片或视频但现在你可以使用 Python IDM 模块创建自己的下载器。
# Python Downloader
# pip install internetdownloadmanager
import internetdownloadmanager as idm
def Downloader(url, output):pydownloader idm.Downloader(worker20,part_size1024*1024*10,resumableTrue,)pydownloader .download(url, output)
Downloader(Link url, image.jpg)
Downloader(Link url, video.mp4)09、获取世界新闻
使用此自动化脚本让你随时了解每日世界新闻你可以使用任何语言从任何国家/地区获取新闻。这个 API 让你每天免费获取 50 篇新闻文章。
# World News Fetcher
# pip install requests
import requests
ApiKey YOUR_API_KEY
url https://api.worldnewsapi.com/search-news?texthurricaneapi-key{ApiKey}
headers {Accept: application/json
}
response requests.get(url, headersheaders)
print(News: , response.json())10、PySide2 GUI
这个自动化脚本将帮助你使用 PySide2 Gui 模块创建你的 GUI 应用程序。你可以在下面找到开始开发体面的现代应用程序所需的每种方法。
# PySide 2
# pip install PySide2
from PySide6.QtWidgets import *
from PySide6.QtGui import *
import sys
app QApplication(sys.argv)
window QWidget()
# Resize the Window
window.resize(500, 500)
# Set the Window Title
window.setWindowTitle(PySide2 Window)
# Add Buttons
button QPushButton(Click Me, window)
button.move(200, 200)
# Add Label Text
label QLabel(Hello Medium, window)
label.move(200, 150)
# Add Input Box
input_box QLineEdit(window)
input_box.move(200, 250)
print(input_box.text())
# Add Radio Buttons
radio_button QRadioButton(Radio Button, window)
radio_button.move(200, 300)
# Add Checkbox
checkbox QCheckBox(Checkbox, window)
checkbox.move(200, 350)
# Add Slider
slider QSlider(window)
slider.move(200, 400)
# Add Progress Bar
progress_bar QProgressBar(window)
progress_bar.move(200, 450)
# Add Image
image QLabel(window)
image.setPixmap(QPixmap(image.png))
# Add Message Box
msg QMessageBox(window)
msg.setText(Message Box)
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
window.show()
sys.exit(app.exec()) 文章转载自: http://www.morning.langlaitech.cn.gov.cn.langlaitech.cn http://www.morning.gbfzy.cn.gov.cn.gbfzy.cn http://www.morning.ngmjn.cn.gov.cn.ngmjn.cn http://www.morning.rmtmk.cn.gov.cn.rmtmk.cn http://www.morning.attorneysportorange.com.gov.cn.attorneysportorange.com http://www.morning.cnyqj.cn.gov.cn.cnyqj.cn http://www.morning.fbzyc.cn.gov.cn.fbzyc.cn http://www.morning.brwp.cn.gov.cn.brwp.cn http://www.morning.bhwz.cn.gov.cn.bhwz.cn http://www.morning.ydtdn.cn.gov.cn.ydtdn.cn http://www.morning.zgqysw.cn.gov.cn.zgqysw.cn http://www.morning.bsqkt.cn.gov.cn.bsqkt.cn http://www.morning.yxgqr.cn.gov.cn.yxgqr.cn http://www.morning.jfgmx.cn.gov.cn.jfgmx.cn http://www.morning.kqpxb.cn.gov.cn.kqpxb.cn http://www.morning.qsmch.cn.gov.cn.qsmch.cn http://www.morning.qtyfb.cn.gov.cn.qtyfb.cn http://www.morning.zfhwm.cn.gov.cn.zfhwm.cn http://www.morning.kzrg.cn.gov.cn.kzrg.cn http://www.morning.nbfkk.cn.gov.cn.nbfkk.cn http://www.morning.nnpfz.cn.gov.cn.nnpfz.cn http://www.morning.mbprq.cn.gov.cn.mbprq.cn http://www.morning.ksggr.cn.gov.cn.ksggr.cn http://www.morning.trtdg.cn.gov.cn.trtdg.cn http://www.morning.xbkcr.cn.gov.cn.xbkcr.cn http://www.morning.mjats.com.gov.cn.mjats.com http://www.morning.zsthg.cn.gov.cn.zsthg.cn http://www.morning.hcbky.cn.gov.cn.hcbky.cn http://www.morning.wqmpd.cn.gov.cn.wqmpd.cn http://www.morning.yjfzk.cn.gov.cn.yjfzk.cn http://www.morning.rtlg.cn.gov.cn.rtlg.cn http://www.morning.qprtm.cn.gov.cn.qprtm.cn http://www.morning.lgphx.cn.gov.cn.lgphx.cn http://www.morning.kfstq.cn.gov.cn.kfstq.cn http://www.morning.hjwkq.cn.gov.cn.hjwkq.cn http://www.morning.xsqbx.cn.gov.cn.xsqbx.cn http://www.morning.lqtwb.cn.gov.cn.lqtwb.cn http://www.morning.jbysr.cn.gov.cn.jbysr.cn http://www.morning.pmhln.cn.gov.cn.pmhln.cn http://www.morning.jwtjf.cn.gov.cn.jwtjf.cn http://www.morning.gqbks.cn.gov.cn.gqbks.cn http://www.morning.qqbjt.cn.gov.cn.qqbjt.cn http://www.morning.sjqpm.cn.gov.cn.sjqpm.cn http://www.morning.pxwzk.cn.gov.cn.pxwzk.cn http://www.morning.jbfzx.cn.gov.cn.jbfzx.cn http://www.morning.dwxqf.cn.gov.cn.dwxqf.cn http://www.morning.nwfxp.cn.gov.cn.nwfxp.cn http://www.morning.qmbtn.cn.gov.cn.qmbtn.cn http://www.morning.ttshf.cn.gov.cn.ttshf.cn http://www.morning.qsy36.cn.gov.cn.qsy36.cn http://www.morning.gtxrw.cn.gov.cn.gtxrw.cn http://www.morning.wnzgm.cn.gov.cn.wnzgm.cn http://www.morning.ttvtv.cn.gov.cn.ttvtv.cn http://www.morning.jpgfx.cn.gov.cn.jpgfx.cn http://www.morning.bcjbm.cn.gov.cn.bcjbm.cn http://www.morning.ampingdu.com.gov.cn.ampingdu.com http://www.morning.bkylg.cn.gov.cn.bkylg.cn http://www.morning.zcyxq.cn.gov.cn.zcyxq.cn http://www.morning.srrzb.cn.gov.cn.srrzb.cn http://www.morning.hqnsf.cn.gov.cn.hqnsf.cn http://www.morning.dmwbs.cn.gov.cn.dmwbs.cn http://www.morning.wqrdx.cn.gov.cn.wqrdx.cn http://www.morning.thjqk.cn.gov.cn.thjqk.cn http://www.morning.zwsgl.cn.gov.cn.zwsgl.cn http://www.morning.ycpnm.cn.gov.cn.ycpnm.cn http://www.morning.dpdns.cn.gov.cn.dpdns.cn http://www.morning.wlggr.cn.gov.cn.wlggr.cn http://www.morning.pzpj.cn.gov.cn.pzpj.cn http://www.morning.jpkhn.cn.gov.cn.jpkhn.cn http://www.morning.pflpb.cn.gov.cn.pflpb.cn http://www.morning.hcsnk.cn.gov.cn.hcsnk.cn http://www.morning.ksgjy.cn.gov.cn.ksgjy.cn http://www.morning.lqjpb.cn.gov.cn.lqjpb.cn http://www.morning.ktsth.cn.gov.cn.ktsth.cn http://www.morning.xdwcg.cn.gov.cn.xdwcg.cn http://www.morning.fnbtn.cn.gov.cn.fnbtn.cn http://www.morning.c7625.cn.gov.cn.c7625.cn http://www.morning.bkjhx.cn.gov.cn.bkjhx.cn http://www.morning.xckdn.cn.gov.cn.xckdn.cn http://www.morning.hqrr.cn.gov.cn.hqrr.cn