本地GIF圖生成網頁預覽工具免費版是一款可以快速生成圖片預覽效果的圖像工具,我們可以通過這款軟件來將GIF圖片進行快速預覽,從而讓你可以了解這些動圖都有什么樣的內容。

不過您內存要是真的沒多大(比如電腦4g內存,2g內存), 一定慎重加載超多圖片!!!
這次的創意. 來自獲取了一堆Gif后,懶著懶著突然有的靈感!...這次軟件特別好寫, 要是有兄臺想模仿或者二次創作, 請一定要艾特我呦!!!之前我寫的一些原創, 有些被人模仿去了, 然沒見艾特我的就很郁悶..有艾特的我的就超開心!
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 + 鼠標滾輪 放大縮小頁面,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("目標文件夾里沒有圖片文件(bmp,jpg,png,gif),請選擇一個有這些圖片類型的文件夾后重新生成網頁")
return False
totalpath=xpath+"\\"+effecttype
totalpath=totalpath.replace("\\\\","\\")
print(totalpath+".html 網頁制作完成")
os.system("explorer /select, "+'\"'+filename+'\"')
except Exception as _ex:
print("程序出現錯誤,請把下面的錯誤復制給制作者用于修改,謝謝!")
print("--------------------------------------------------------")
print('traceback.format_exc():\n%s' % traceback.format_exc())
print("--------------------------------------------------------")
print(effecttype+"網頁制作失敗,請聯系制作者")
if __name__ == '__main__':
print("圖片生成網頁預覽(gif,png,bmp,jpg) 吾愛破解論壇 52pojie.cn")
path=input("請粘貼或者拖拽一個圖片文件夾的路徑,用來生成網頁:\r\n")
while True:
path=path.replace("\"", "")
if os.path.exists(path):
bool1 = path.endswith("\\")
if bool1:
path=path.strip('\\')
makeweb(path)
else:
print("目標文件夾不存在,請重新選擇一個有效的文件夾來生成圖片網頁")
path=input("本次操作完畢,繼續操作請再次粘貼或者拖拽一個圖片文件夾的路徑,結束請直接關閉本窗口:\r\n")