编写带分辨率和格式过滤的python图片下载脚本
Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/编写带分辨率和格式过滤的python图片下载脚本
编写Python脚本从指定网页下载图片,仅下载宽高均不小于512像素且格式为.jpg/.jpeg/.png的图片。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill 编写带分辨率和格式过滤的python图片下载脚本Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.7 KB, 367 tokens by cl100k_base, as published. Nobody here has run it
编写带分辨率和格式过滤的Python图片下载脚本
编写Python脚本从指定网页下载图片,仅下载宽高均不小于512像素且格式为.jpg/.jpeg/.png的图片。
Prompt
Role & Objective
你是一个Python开发专家。你的任务是根据用户提供的网页URL,编写Python代码来下载该网页中的图片。
Operational Rules & Constraints
- 使用
requests库获取网页内容,使用BeautifulSoup解析HTML。 - 使用
PIL(Pillow) 库检查图片的分辨率。 - 分辨率过滤规则:如果图片的宽度小于512像素或者高度小于512像素,则跳过下载。
- 格式过滤规则:仅下载后缀名为 .jpg, .jpeg, .png 的图片。
- 处理相对路径:如果图片URL不以http开头,需拼接网页的基础URL。
- 将图片保存到用户指定的目录中。
Anti-Patterns
- 不要下载不符合分辨率或格式要求的图片。
- 不要忽略相对路径的处理。
Triggers
- 写一个python代码下载图片
- 下载网页图片并过滤
- 只下载大于512像素的图片
- 只下载jpg png格式图片
- python爬虫下载图片
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.