/中文/
/中文/
/中文/
/中文/
/中文/
/中文/
/中文/
/中文/
/中文/
/中文/
本地GIF圖生成網(wǎng)頁預(yù)覽工具是一款非常不錯的圖像預(yù)覽軟件,能夠幫助用戶快速生成文件中的圖片預(yù)覽效果,可以一下子預(yù)覽全部的動態(tài)圖,使用起來非常方便有需要的用戶不要錯過了,趕快來下載吧!
電腦里有很多Gif圖, 電腦的縮略圖只能生成靜幀的預(yù)覽圖,而可以通過這個生成個網(wǎng)頁,可以一下子預(yù)覽全部的動態(tài)圖了. 當(dāng)然,也有個弊端,一次加載大量的gif到網(wǎng)頁上, 會特別特別占內(nèi)存,就需要一個大內(nèi)存.不過這都2021年了.誰還沒個十幾二十幾大幾十幾的內(nèi)存嘞?
不過您內(nèi)存要是真的沒多大(比如電腦4g內(nèi)存,2g內(nèi)存), 一定慎重加載超多圖片!!!
這次的創(chuàng)意. 來自獲取了一堆Gif后,懶著懶著突然有的靈感!...這次軟件特別好寫, 要是有兄臺想模仿或者二次創(chuàng)作, 請一定要艾特我呦!!!之前我寫的一些原創(chuàng), 有些被人模仿去了, 然沒見艾特我的就很郁悶..有艾特的我的就超開心!
import os
import traceback
def makeweb(xpath):
filespath=""
contentfiles=[]
try:
list_dirs = os.walk(xpath)
for root, _dirs, files in list_dirs:
for f in files:
f=f.lower()
bool1 = f.endswith(".gif")
bool2 = f.endswith(".jpg")
bool3 = f.endswith(".png")
bool4 = f.endswith(".bmp")
if bool1 or bool2 or bool3 or bool4:
shortpath=root[len(xpath)+1:len(root)]
if len(shortpath)>0:
filespath=shortpath+"\\"+f
contentfiles.append(filespath)
else:
filespath=f
contentfiles.append(filespath)
if len(contentfiles)>0:
effecttype = os.path.basename(xpath)#帶后綴的文件名
#effecttype="火焰"
filename = xpath+'\\'+effecttype+'.html'
with open(filename, 'w',encoding="utf-8") as file_object:
file_object.write("<!DOCTYPE html>\n")
file_object.write("<html>\n")
file_object.write("<title>"+effecttype+"</title>\n")
file_object.write("<style type=\"text/css\">.left{float: left;}.pic {/*max-width: 300px;height:auto;*/max-height: 130px;width: auto;} </style>\n")
file_object.write("<head><link rel=\"icon\" type=\"image/x-icon\" href=\""+contentfiles[0]+"\" /></head>\n")
file_object.write("<body>\n")
file_object.write("<h5>可以按住Ctrl + 鼠標(biāo)滾輪 放大縮小頁面,Ctrl + 0 重置頁面</h5>\n")
file_object.write("<h5>"+effecttype+"分類</h5>\n")
for i in contentfiles:
file_object.write("<div class=\"left\"><a href=\""+i+"\" target=\"_blank\"><img class=\"pic\" src=\""+i+"\" ></a></div>\n")
file_object.write("</body>\n")
file_object.write("</html>\n")
else:
print("目標(biāo)文件夾里沒有圖片文件(bmp,jpg,png,gif),請選擇一個有這些圖片類型的文件夾后重新生成網(wǎng)頁")
return False
totalpath=xpath+"\\"+effecttype
totalpath=totalpath.replace("\\\\","\\")
print(totalpath+".html 網(wǎng)頁制作完成")
os.system("explorer /select, "+'\"'+filename+'\"')
except Exception as _ex:
print("程序出現(xiàn)錯誤,請把下面的錯誤復(fù)制給制作者用于修改,謝謝!")
print("--------------------------------------------------------")
print('traceback.format_exc():\n%s' % traceback.format_exc())
print("--------------------------------------------------------")
print(effecttype+"網(wǎng)頁制作失敗,請聯(lián)系制作者")
if __name__ == '__main__':
print("圖片生成網(wǎng)頁預(yù)覽(gif,png,bmp,jpg) 吾愛破解論壇 52pojie.cn")
path=input("請粘貼或者拖拽一個圖片文件夾的路徑,用來生成網(wǎng)頁:\r\n")
while True:
path=path.replace("\"", "")
if os.path.exists(path):
bool1 = path.endswith("\\")
if bool1:
path=path.strip('\\')
makeweb(path)
else:
print("目標(biāo)文件夾不存在,請重新選擇一個有效的文件夾來生成圖片網(wǎng)頁")
path=input("本次操作完畢,繼續(xù)操作請再次粘貼或者拖拽一個圖片文件夾的路徑,結(jié)束請直接關(guān)閉本窗口:\r\n")
關(guān)于騰牛 | 聯(lián)系方式 | 發(fā)展歷程 | 版權(quán)聲明 | 下載幫助(?) | 廣告聯(lián)系 | 網(wǎng)站地圖 | 友情鏈接
Copyright 2005-2024 QQTN.com 【騰牛網(wǎng)】 版權(quán)所有 鄂ICP備2022005668號-1 | 鄂公網(wǎng)安備 42011102000260號
聲明:本站非騰訊QQ官方網(wǎng)站 所有軟件和文章來自互聯(lián)網(wǎng) 如有異議 請與本站聯(lián)系 本站為非贏利性網(wǎng)站 不接受任何贊助和廣告