{"id":13634920,"url":"https://github.com/JackHCC/SlideShow","last_synced_at":"2025-04-19T03:34:04.367Z","repository":{"id":112238398,"uuid":"183414028","full_name":"JackHCC/SlideShow","owner":"JackHCC","description":"python照片墙设计，将爬虫获取的照片布局成爱心形状~( Python photo wall design, layout photos taken by reptiles into a love shape~)","archived":false,"fork":false,"pushed_at":"2019-04-25T12:25:15.000Z","size":446,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-02T00:21:43.704Z","etag":null,"topics":["mini-program","pil","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JackHCC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-25T10:42:31.000Z","updated_at":"2023-12-01T17:35:01.000Z","dependencies_parsed_at":"2023-05-07T04:16:26.114Z","dependency_job_id":null,"html_url":"https://github.com/JackHCC/SlideShow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHCC%2FSlideShow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHCC%2FSlideShow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHCC%2FSlideShow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHCC%2FSlideShow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JackHCC","download_url":"https://codeload.github.com/JackHCC/SlideShow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223790228,"owners_count":17203350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mini-program","pil","python"],"created_at":"2024-08-02T00:00:37.675Z","updated_at":"2024-11-09T05:30:15.219Z","avatar_url":"https://github.com/JackHCC.png","language":"Python","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# python照片墙设计\n### 代码规划：\n+ 将爬虫爬取的图片进行处理，减小尺寸\n+ 将处理好的图片进行照片墙设计\n### 图片处理ImageSolve.py:批量处理\n+ 导入库：PIL:图像处理；glob\n```\nfrom PIL import Image\nimport os.path\nimport glob\n```\n+ 定义ReSize函数：\n```\n#由于爬虫获取的照片尺寸太大，我们更改爬虫获取的照片尺寸大小\ndef Resize(file, outdir, width, height):\n    imgFile = Image.open(file)\n    try:\n        newImage = imgFile.resize((width, height), Image.BILINEAR)    #更改尺寸\n        newImage.save(os.path.join(outdir, os.path.basename(file)))     #输出保存图片\n    except Exception as e:\n        print(e)\n```\n+ 处理后照片的存储\n```\nfor file in glob.glob(\"res\\\\*.jpg\"):  # 图片所在的目录\n    Resize(file, \"new\", 100, 100)  # 新图片存放的目录\n```\n### 照片墙展示\n+ 导入库\n```\nimport sys\nfrom PyQt5.QtGui import QPixmap\nfrom PyQt5.QtWidgets import *\n```\n+ Qt窗口基本创建\n```\napp = QApplication(sys.argv)\n\nwin = QWidget()\nwin.resize(760, 540)\nwin.move(0, 0)\nlayout=QGridLayout(win)\n\npositionSet()\nwin.setWindowTitle('GUI')\nwin.show()\n```\n+ 背景图设置\n```\nb=QLabel(win)\nb.setPixmap(QPixmap(\"bg.jpg\"))\nb.setGeometry(0,0,820,640)\n```\n+ 布局函数\n```\ndef positionSet():\n```\n### 结果展示\n![show](result.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJackHCC%2FSlideShow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJackHCC%2FSlideShow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJackHCC%2FSlideShow/lists"}