从桌面壁纸到AI绘画
由于生活和工作需要,小编要长时间的使用电脑,小编又懒,一个主题用半年的那种,所以桌面壁纸也是处于常年不更换的状态。即时改变主题也是在微软自带的壁纸中选择,而这些自带的壁纸早就已经看腻了。于是,问题产生了:如何让电脑自动变更自己喜欢的壁纸?
经过思考,大致可以有2个方案:
方案一:通过下载壁纸软件,让壁纸软件自动切换
方案二:下载壁纸后保存到本地,通过系统自动切换
在网上找寻一通后,发现有几款壁纸软件挺不错的。比如:元气桌面、飞火动态壁纸、UPUPOO动态桌面。但是经过试用,发现该方案还是有不如人意的地方:
1、这些壁纸软件在没有购买成为会员之前,大部分图片都不能下载作为壁纸,并且大部分只能按月购买会员,费用还不低(十几元~几十元/月不等)。Steam上大名鼎鼎的wallpaper engine壁纸软件才19元,而且是终生。不知道这些国产壁纸软件凭啥卖这么贵。
2、仅有元气桌面壁纸软件提供了订阅功能(选择喜欢的类型或风格),其它壁纸软件不支持。
虽然该方案的不太适合,但是该说不说。这些壁纸软件里有些图片还是很不错的,有真人图、二次元图、AI图:
1、找到壁纸网站,最好符合以下优点:
2、找到想要的图片,点击下载到本地电脑上。保存到单独的文件夹中。
3、进入Windows设置\个性化:
6、此时在下方可以看到幻灯片放映
的相关设置,可以设置图片切换频率
、是否无序播放
、契合度推荐选择填充。
7、设置完成。接下来,系统会每隔一段时间在目标文件夹中挑选一张图片作为壁纸。也可以在桌面上手动切换,方法就是右键后,在弹出的菜单中点击下一个桌面背景
。如下:
方案二虽然不错,但是需要手动下载壁纸,还是比较麻烦的。于是,打算通过Python自动批量下载,省时省力(人生苦短,我用Python)。
由于是要从网站上下载图片,那么一般是使用requests或selenium库。小编这里采用的是selenium库。再结合多线程,10几分钟也就下载好了目标网站上的所有想要的3000多张壁纸。
# Encoding: utf-8
# Author: 思必得
# Date: 2023/9/20 16:36
# Project name: 下载图片
# IDE: PyCharm
# File name: 下载图片.py
# Python required version:未指定
# 模块说明:
"""
从指定的图片网站上下载壁纸图片
"""
# 导入模块:
from selenium.webdriver.common.by import By
from mdBrowser import csBrowserBySelenium
from mdTools import ftSoundBeep
from threading import Thread
from tqdm import trange
import requests
import time
import re
import os
# 更新日志:
"""
1、2023/9/20:
a、创建文件
"""
# 待修改:
"""
"""
csbbs = csBrowserBySelenium()
class DownloadPic:
def __init__(self):
self.headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
'Referer': '图片网站',
}
self.pic_urls = [] # 初始pic地址
self.pic_urls_api = [] # 重定向后的完整pic地址(带参数)
def get_pic_url(self):
el_next = csbbs.mtElIsExist('//*[@id="app"]/div[1]/main/div/div/div/div[5]/div/div/div/div/div[1]/div[2]')
div = csbbs.mtElIsExist('//*[@id="app"]/div/main/div/div/div/div[4]')
divs = div.find_elements(by=By.CLASS_NAME, value='img-box')
for div in divs:
a = div.find_element(By.CLASS_NAME, value='down-span').find_element(By.TAG_NAME, value='a')
self.pic_urls.append(a.get_attribute('href'))
el_next.click()
time.sleep(3)
def get_pic_api_th(self, url):
r = requests.get(url=url, headers=self.headers, allow_redirects=False) # 禁用重定向
self.pic_urls_api.append(r.headers['Location'])
def download_pic_th(self, url):
r = requests.get(url=url, headers=self.headers)
pic_name = os.path.join(r'G:\资源素材\壁纸\zzzmh', re.split(r'[?/]', url)[5])
with open(pic_name, 'wb') as f:
f.write(r.content)
def main(self):
"""通过翻页获取到每页每张图片的初始地址"""
for _ in trange(112):
self.get_pic_url()
"""通过图片的初始地址获取到图片的完整地址"""
self.pic_urls_api = []
ths = []
for _ in self.pic_urls:
th = Thread(target=self.get_pic_api_th, args=(_,))
ths.append(th)
th.start()
for th in ths:
th.join()
self.pic_urls = []
"""通过图片的完整地址下载到本地电脑"""
for _ in self.pic_urls_api:
th = Thread(target=self.download_pic_th, args=(_,))
ths.append(th)
th.start()
for th in ths:
th.join()
ftSoundBeep()
if __name__ == '__main__':
dp = DownloadPic()
dp.main()
注意事项:
在多线程爬取时,一定要注意等待,不要一次太快爬取太多,否则容易被阻止访问。
效果如下:
无论是壁纸软件也好,壁纸网站也好,发现有很多都是AI制作的壁纸,而且质量还很高。于是,突发奇想,是否可以通过AI绘画的形式,让AI来直接绘制壁纸呢?
AI绘画的优势很明显,没有版权问题,自由度高,定制化高。
于是小编便一头扎进了AI绘画这个大坑之中。。。
总之是一言难尽,AI绘画就是个大坑,期间查询了很多资料,看了很多教程、文章、视频。发现AI绘画的水很深,一般人想要入坑了解、学习、掌握的门槛特别高。
不过,好在有简易入门使用的方法,现分享出来给大家。不过在此,需要先对AI绘画有个初步的了解。
如果我们要找别人绘画,我们会先去找一个画家,而每个画家有不同的风格,有的擅长写实、有的擅长人物、有的擅长二次元、有的擅长风景等等。而在AI绘画中,不同的风格就是模型
,你选择不同的模型,就会导致AI绘画时作出不同风格的画出来。
有了画家
还不行,我们还需要告诉画家
我们要画一副什么画,比如:我想画一个中国年轻男人在一个夏天大雨过后在草地上骑马奔驰的画面。那么这里的一个
、中国
、年轻
、男人
、夏天
、大雨
、草地
、骑马
等都是提示词
。在AI绘画中也称为:标签
、Tag
、Prompt
,都是同一个意思。这就和你让画家画画一样,给的提示词越详细、越具体,这个画家就更容易画出你想要的画面。
当然,提示词有正面
和负面
之分。正面的就是我们想要出现在画面中,而负面就是不想要出现在画面中。
提示词还有权重的区别,权重越大,这个提示词提到的内容占比就越大。
操作系统:win10及以上
CPU:无强制要求
内存:>8G
显卡:独立N卡,显存>4G
1、下载B站秋叶大佬(人称:赛博佛祖)的最新Stable Diffusion整合包v4.4
`整合包说明:`
所谓的整合包就是打包了运行必须得Python、git环境,并且预置好模型,添加了一些常用的插件。
所有环境都可以在这个整合包内随用随删,环境是`独立`且`虚拟`的,不会产生任何冲突。
比自己按照教程手动部署不知道要方便了多少倍。不知道拯救了多少个像小编一样在手动部署中陷入痛苦与挣扎的人(一堆的报错。。。)。可谓功德无量。
2、将下载好的整合包解压,最好放在固态硬盘中,可以加快运行速度。
3、双击打开启动器运行依赖-dotnet-6.0.11.exe
以安装启动器运行时需要的依赖。
4、进入到sd-webui-aki-v4.1
(这里小编用的是v4.1版本),双击打开A启动器.exe
,主界面如下:
6、等待片刻后会自动在默认浏览器中打开网站,进入到AI绘画的页面中:
7、里面的内容都是中文的,一切的配置都不需要动。我们看到左上角可以选择模型,使用自带的sd-v1-4
模型即可。然后在正向提示词和反向提示词中填入你想要的即可。新手刚开始不知道要怎么填,这里,小编提供1组:
正向:
(photo photography), (Chinese girl), 1 girl, solo, beautiful, lovely, lifelike facial details, delicate facial features, long black hair, big chest, facing the audience, smile, powder blusher, delicate collarbone, pink skirt, big legs, slippers, interior, living room, huge sofa, tea table, fruit, banana, grape, pitaya, vase, flower arrangement, masterpiece, official art, 8K, CG rendering, complex details, (Photography: 1.1), (Gorgeous Chinese Women: 1.3), Instagram, (Photo Realism: 0.8)
反向:
bad anatomy, error, jpeg artifacts, low quality, lowres, normal quality, worst quality, fewer digits, extra digits, bad hands, bad feet, cropped, missing fingers, signature, text, username, watermark, futa
8、填写后,点击右侧的生成
,等待程序完成即可。生成的速度和电脑配置,尤其是显卡的配置有关,一般要1分钟及以上。
9、生成的图片保存在:sd-webui-aki-v4.1\outputs\txt2img-images中。
好了,以上就是AI绘画中,文生图的基本用法。可以看到还是很简单的。这个AI程序还有更多的功能,比如:更换模型、图生图、后期处理、PNG图片信息、图片放大等等,大家可以自行去了解。
Beautiful
Radiant
Elegant
Charming
Lovely
Graceful
Alluring
Stunning
Enchanting
Mesmerizing
Exquisite
Ravishing
Captivating
Bewitching
Gorgeous
Attractive
Fascinating
Delicate
Disarming
Winsome
Enticing
Poised
Sophisticated
Classy
Glamorous
Stylish
Fashionable
Trendy
Chic
Enigmatic
Mysterious
Intriguing
Dreamy
Sassy
Witty
Humorous
Fun-loving
Lively
Bubbly
Playful
Animated
Energetic
Dynamic
Ambitious
Driven
Confident
Independent
Strong-minded
Fearless
Bold
Daring
Adventurous
Bold
Spontaneous
Unpredictable
Creative
Artistic
Visionary
Innovative
Resourceful
Practical
Logical
Analytical
Intellectual
Smart
Witty
Clever
Sharp
Keen
Perceptive
Intuitive
Empathetic
Compassionate
Understanding
Attentive
Patient
Tolerant
Forgiving
Caring
Thoughtful
Kind-hearted
Generous
Charitable
Philanthropic
Helper
Selfless
Modest
Humble
Respectful
Trustworthy
Reliable
Loyal
Faithful
Honest
Sincere
Genuine
Authentic
Natural
Unassuming
Gracious
模型:guofeng3
提示词:best quality,masterpiece,highres,1girl,blush,(seductive smile:0.8),star-shaped pupils,red china hanfu,hanfu,chinese clothes,hair ornament,necklace,jewelry,Beautiful face,upon_body,tyndall effect,photorealistic,dark studio,rim lighting,two tone lighting,(high detailed skin:1.2),8k uhd,dslr,soft lighting,high quality,volumetric lighting,candid,Photograph,high resolution,4k,8k,Bokeh,
反向提示词:
(((simple background))),monochrome,lowres,bad anatomy,bad hands,text,error,missing fingers,extra digit,fewer digits,cropped,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,username,blurry,lowres,bad anatomy,bad hands,text,error,extra digit,fewer digits,cropped,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,username,blurry,ugly,pregnant,vore,duplicate,morbid,mut ilated,tran nsexual,hermaphrodite,long neck,mutated hands,poorly drawn hands,poorly drawn face,mutation,deformed,blurry,bad anatomy,bad proportions,malformed limbs,extra limbs,cloned face,disfigured,gross proportions,(((missing arms))),(((missing legs))),(((extra arms))),(((extra legs))),pubic hair,plump,bad legs,error legs,username,blurry,bad feet,
提示词:
best quality,masterpiece,highres,cg,1girl,weapon,sword,long hair,dress,water,solo,jewelry,white dress,earrings,hair ornament,splashing,upper body,hair bun,black hair,lighting,candid,Photograph,high resolution,4k,8k,Bokeh,
反向提示词:
(((simple background))),monochrome ,lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, lowres, bad anatomy, bad hands, text, error, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, ugly,pregnant,vore,duplicate,morbid,mut ilated,tran nsexual, hermaphrodite,long neck,mutated hands,poorly drawn hands,poorly drawn face,mutation,deformed,blurry,bad anatomy,bad proportions,malformed limbs,extra limbs,cloned face,disfigured,gross proportions, (((missing arms))),(((missing legs))), (((extra arms))),(((extra legs))),pubic hair, plump,bad legs,error legs,username,blurry,bad feet
提示词:
best quality,masterpiece,highres,cg,1girl,long hair,dress,water,solo,jewelry,white dress,earrings,hair ornament,splashing,upper body,hair bun,black hair,lighting,candid,Photograph,high resolution,4k,8k,Bokeh,lora:moreDetails.5pEa:0.8,
反向提示词:
(((simple background))),monochrome,lowres,bad anatomy,bad hands,text,error,missing fingers,extra digit,fewer digits,cropped,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,username,blurry,lowres,bad anatomy,bad hands,text,error,extra digit,fewer digits,cropped,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,username,blurry,ugly,pregnant,vore,duplicate,morbid,mut ilated,tran nsexual,hermaphrodite,long neck,mutated hands,poorly drawn hands,poorly drawn face,mutation,deformed,blurry,bad anatomy,bad proportions,malformed limbs,extra limbs,cloned face,disfigured,gross proportions,(((missing arms))),(((missing legs))),(((extra arms))),(((extra legs))),pubic hair,plump,bad legs,error legs,username,blurry,bad feet,
模型:QteaMix
提示词:(masterpiece:1.2, best quality:1.2) , {fox girl} , {{fox ear}} , very long hair , grey hair , medium breasts , {{ miko }} ,black eyes ,((masterpiece)), (((best quality))), ((ultra-detailed)), ((illustration)), ((disheveled hair)) , solo , {japanese shrine} , perfect hand , perfect fingers ,{{{ japanese festival , night time }}}, smile , solo focus , lie down , lying
负面提示词:
(worst quality, low quality, large head, extra digits:1.4), bad hands, mutated hand, (six or more fingers:1.7), (tangled fingers:1.3), complex fingers, (spindly fingers:1.3), broken fingers, missing fingers, text , monochrome
提示词:
embarrassed blush @_@ covering wavy mouth,12-year-old girl with wavy red-brown hair, pink dress. Big blue eyes, rosy cheeks, and a white tail. Outfit includes a pink dress, black collar with cat medallion, sky blue ribbon with red heart,a large sky blue bow in one ear,small chest,sound effects
负面提示词:
worst quality, large head, low quality, extra digits, bad eyes, EasyNegativeV2, ng_deepnegative_v1_75t
基底模型:SDXL 1.0
提示词:
Hyperrealistic art BJ_Sacred_beast, red_eyes, outdoors, horns, sky, teeth, day, cloud, no_humans, cloudy_sky, scenery, smoke, mountain, dragon,cinematic lighting,strong contrast,high level of detail,Best quality,masterpiece,lora:SDXL_Sacred_beast:0.7, . Extremely high-resolution details, photographic, realism pushed to extreme, fine texture, incredibly lifelike
反向提示词:
simplified, abstract, unrealistic, impressionistic, low resolution, embedding:BadDream,embedding:FastNegativeV2,
提示词:
Hyperrealistic art skin gloss,light persona,(crystalstexture skin:1.2),(extremely delicate and beautiful),pov,(white_skin:1.2),1girl,solo,long_hair,bare shoulders,red_dress,skirt,(((wings,red_wings))),(full shot),looking_at_viewer,BJ_Sacred_beast,full body,run,suspension,outdoors,sky,day,cloud,fire,water,blue_sky,ocean,cloudy_sky,cinematic lighting,strong contrast,high level of detail,Best quality,masterpiece,lora:SDXL_Sacred_beast:0.7, . Extremely high-resolution details, photographic, realism pushed to extreme, fine texture, incredibly lifelike
反向提示词:
simplified, abstract, unrealistic, impressionistic, low resolution, embedding:BadDream,embedding:FastNegativeV2,