nasa apod壁纸下载
apod-wallpaper的Python项目详细描述
APOD壁纸
利用nasa apod api生成带有解释的墙纸。 -将下载图像(单个、随机或全部在日期范围内) -仅支持图像媒体类型(无视频)。 -如果未指定,则使用Tkinter尝试调整墙纸的大小。 -默认情况下,在带水印的页脚中添加每日图像的说明。
安装
pip install apod-wallpaper
有关安装PIL依赖项的问题: -使用包管理器安装libjpeg dev&;freetype dev(apt、yum、brew等)
pip install PIL --allow-external PIL --allow-unverified PIL
用法
下载单一日期
fromapod_wallpaperimportapodfromdatetimeimportdateapod.download_single(single_date=date(2015,07,01))
随机下载
默认为start_date=date(1995, 6, 20)(nasa开始的第一天 发布每日图片)和end_date=date.today()
fromapod_wallpaperimportapodapod.download_random()
批量下载
选择APOD的范围(有助于跟踪最近的未命中事件)
fromapod_wallpaperimportapodfromdatetimeimportdateapod.download_bulk(start_date=date(2015,07,01),end_date=date(2015,07,05))
所有美国航天局APOD图像(请注意:您可能不需要这个)
fromapod_wallpaperimportapodapod.download_bulk()
可选参数
download_path: (optional) File location to store downloaded image (default ~/wallpapers). overwrite: (optional) Overwrite existing files in download_path (default: False) screen_width: (optional) Pixels of width to make image. Large than original will add a black background. If not specified, OS detection of screen width will be attempted. screen_height: (optional) Pixels of height to make image. Large than original will add a black background. If not specified, OS detection of screen width will be attempted. font: (optional) TrueType font to apply in image footer (default OpenSans-Regular.ttf). font_size: (optional) Size of TrueType font in image footer (default 18). margin: (optional) Pixels around image footer text (default 50). font_color: (optional) RGBA tuple for color of font (default white). background_color: (optional) RBGA tuple for color of background (default black). opacity: (optional) Opacity for image footer (default 0.8).
测试
pythontest_apod.py
致谢
- 美国宇航局APOD API通过Bowshock 包装库
- 从Font Squirrel打开sans字体
- 图像处理 Pillow