怎么把批量把文件夹第一张图片在文件夹上显示 在 节操の广场 发布于九月 18, 2023 如果你会python的话 希望下面这段我自用的代码能帮到你。 这是我用来给黄油改文件夹封面用的 from PIL import Image import os import re def make_ico_file(src_image_file, dist_ico_file, size_list=None): """ :param src_image_file: :param dist_ico_file: :return: """ default_size_list = [ (256, 256), (128, 128), (64, 64), (48, 48), (32, 32), (24, 24), (16, 16) ] size_list = size_list or default_size_list image = Image.open(src_image_file) image = image.convert('RGBA') image.thumbnail([256, 256]) width, height = image.size new_image = Image.new('RGBA', (256, 256), (0, 0, 0, 0)) if width == 256: upper = (256 - height) // 2 new_image.paste(image, (0, upper)) elif height == 256: left = (256 - width) // 2 new_image.paste(image, (left, 0)) else: print('error') # image_cropped = image.crop((0, 0, 256, 256)) # new_image.save(r'.\test\re.png') new_image.save(dist_ico_file, sizes=size_list) def listdirs(folder): return [ d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d) ] def listfiles(folder): return [ d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isfile(d) ] def find_getchu_cover(folder): pattern = r'c[0-9]+package\.jpg' f = listfiles(folder) for file in f: result = re.search(pattern, file) if result is not None: return result.group() if __name__ == '__main__': base_dir = r'E:\EroEroEro' dirs = listdirs(base_dir) cover_path = '' for name in dirs: if os.path.exists(name + "\\cover.jpg"): cover_path = name + "\\cover.jpg" elif find_getchu_cover(name) is not None: cover_path = name + '\\' + find_getchu_cover(name) else: print("Cover Not Found") break make_ico_file(src_image_file=cover_path, dist_ico_file=name + '\\fic.ico') desktop_ini = ["[.ShellClassInfo]\n\r", "IconResource=fic.ico,0\n\r", 'FolderType=Pictures'] with open(name + '\\desktop.ini', 'w') as f: f.writelines(desktop_ini) f.close() print(name) os.system('attrib +s +h ' + '"' + name + '"' + '\\desktop.ini') os.system('attrib +r ' + '"' + name + '"')
现在游戏商人是不是和显卡商人合伙了 在 一般向游戏交流区 发布于六月 13, 2017 1 小时前, wymca 说道: CPU 顯卡巴 !! 做一堆 要很高才能玩的遊戲 逼人一定要換 英特尔的9系显卡已经推出了 不来一发么?
现在游戏商人是不是和显卡商人合伙了 在 一般向游戏交流区 发布于六月 13, 2017 1 小时前, deepdragon 说道: 你这点搞错了,显卡就是发动机生产商,游戏商则是车厂。游戏想卖得好,那肯定得画面好吧,所以追求高性能高优化的显卡是必然的。 也不一定 游戏厂商和硬件商达成了PY交易后 就会做出些调整 主机上的就是独占 PC上就是针对A卡或者G卡单独优化
所以这一波更新目前最大的优势就是炸鱼吗 在 暗の广场 发布于六月 13, 2017 32 分钟前, eroko 说道: 北方有鱼 深潜海底 味贼咸 而不语 最主要的还是我在里区的帖子全被删了 发帖数暴跌
大家玩过那些结局坑爹的游戏 在 一般向游戏交流区 发布于六月 13, 2017 尼尔2 抱着傻白甜的心情去舔2B 最后被塞得满满一嘴的屎关游戏 太空捡垃圾 最后发现其实自己不是人类 是个被灌输了人类意识的异形 而地球已经变成了异形的巢穴
有多少人觉得那些开放编辑器的游戏打上绅士MOD比HGAME更带感? 在 一般向游戏交流区 发布于六月 13, 2017 老滚10G 我装完MOD后70G 高清材质 4K分辨率 人物美化一套 萝莉大陆MOD一套 然后异种妊娠MOD 战败Hmod NTRmod FUTAMOD 群PMOD 卖春MOD 各种衣服MOD 武器MOD 场景MOD 贼爽
感觉我坛用户真的是素质高 在 暗の广场 发布于六月 13, 2017 23 小时前, 粪海狂蛆 说道: 很多论坛也好资源站也好,就算没有规定回复数,需要回复可见的地方基本上都是111,222,ddddddd,sdsdsdsdsd这种,更别提像咱坛这样的大改了。。逛了俩小时水区了,一个这样的回复也没有,不由得感叹咱坛用户素质真的是比较高的 你像这样回复 你的号就飞了啊 大兄弟
如何把Google验证搞回来,另外有账号链接的打算么 在 暗の广场 发布于六月 13, 2017 3 分钟前, howhow137 说道: 为什么我昨晚试了几个小时都还是不能谷歌身份验证成功呢 说明你该换代理了
怎么把批量把文件夹第一张图片在文件夹上显示
在 节操の广场
发布于
如果你会python的话 希望下面这段我自用的代码能帮到你。
这是我用来给黄油改文件夹封面用的
from PIL import Image import os import re def make_ico_file(src_image_file, dist_ico_file, size_list=None): """ :param src_image_file: :param dist_ico_file: :return: """ default_size_list = [ (256, 256), (128, 128), (64, 64), (48, 48), (32, 32), (24, 24), (16, 16) ] size_list = size_list or default_size_list image = Image.open(src_image_file) image = image.convert('RGBA') image.thumbnail([256, 256]) width, height = image.size new_image = Image.new('RGBA', (256, 256), (0, 0, 0, 0)) if width == 256: upper = (256 - height) // 2 new_image.paste(image, (0, upper)) elif height == 256: left = (256 - width) // 2 new_image.paste(image, (left, 0)) else: print('error') # image_cropped = image.crop((0, 0, 256, 256)) # new_image.save(r'.\test\re.png') new_image.save(dist_ico_file, sizes=size_list) def listdirs(folder): return [ d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d) ] def listfiles(folder): return [ d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isfile(d) ] def find_getchu_cover(folder): pattern = r'c[0-9]+package\.jpg' f = listfiles(folder) for file in f: result = re.search(pattern, file) if result is not None: return result.group() if __name__ == '__main__': base_dir = r'E:\EroEroEro' dirs = listdirs(base_dir) cover_path = '' for name in dirs: if os.path.exists(name + "\\cover.jpg"): cover_path = name + "\\cover.jpg" elif find_getchu_cover(name) is not None: cover_path = name + '\\' + find_getchu_cover(name) else: print("Cover Not Found") break make_ico_file(src_image_file=cover_path, dist_ico_file=name + '\\fic.ico') desktop_ini = ["[.ShellClassInfo]\n\r", "IconResource=fic.ico,0\n\r", 'FolderType=Pictures'] with open(name + '\\desktop.ini', 'w') as f: f.writelines(desktop_ini) f.close() print(name) os.system('attrib +s +h ' + '"' + name + '"' + '\\desktop.ini') os.system('attrib +r ' + '"' + name + '"')