在您的 GitHub 存储库中,创建工作流文件或扩展现有文件。(例如.github/workflows/gif.yml
)
您还必须包括一个步骤checkout
并提交回购协议。您可以使用以下示例gif.yml
。确保修改该值并添加您要使用的url
任何其他输入。
.github/workflows/gif.yml
name: Generate demo file
on: push
jobs:
generate-gif:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Website to file
uses: PabloLec/website-to-gif@2.1.0
with:
url: "https://docs.github.com/en/get-started"
- name: Commit file to GH repo
run: |
git config --global user.name "PabloLec/website-to-gif"
git config --global user.email "action@github.com"
git add .
git commit -m 'Update file'
git push
请参阅官方 GitHub 文档以进一步自定义您的工作流程。
姓名 | 描述 | 默认 | 例子 |
---|---|---|---|
网址 | 要捕获的网页 URL。必需的 | url: "https://docs.github.com" |
|
保存路径 | 文件保存路径,以/ .开头 确保您提供的路径已经存在,因为此操作不会创建任何目录。 |
回购根 | save_path: "/docs/images/" |
文件格式 | 输出文件格式,目前支持GIF和WebP | 动图 | file_format: "WebP" |
文件名 | 文件名,不包括扩展名或路径 | 演示 | file_name: "ss_25_tps_100" |
窗口宽度 | 浏览器窗口宽度 | 1920(像素) | window_width: 1366 |
窗口高度 | 浏览器窗口高度 | 1080(像素) | window_height: 768 |
停止_y | 文件捕获应该停止的位置 | 页面底部 | stop_y: 800 |
开始_y | 文件捕获应该开始的位置 | 0(像素) | start_y: 1024 |
最终宽度 | 最终文件宽度 | 640(像素) | final_width: 1024 |
最终高度 | 最终文件高度 | 360(像素) | final_height: 576 |
滚动步骤 | 滚动像素数 | 25(像素) | scroll_step: 50 |
每帧时间 | 每帧毫秒 | 100(毫秒) | time_per_frame: 200 |
开始延迟 | 开始捕获前等待的毫秒数 | 0(毫秒) | start_delay: 100 |
no_scoll | 在没有页面滚动的情况下捕获 GIF,将丢弃任何与滚动相关的参数 | 错误的 | no_scoll: true |
帧间时间 | 如果 no_scroll 为真,帧捕获之间的毫秒数 | 100(毫秒) | time_between_frames: 200 |
帧数 | no_scroll 为真时捕获的帧数 | 20 | number_of_frames: 50 |
resizing_filter | 用于调整帧大小的过滤器,请参阅https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=resize#PIL.Image.Image.resize | 兰素 | resizing_filter: "LANCZOS" |
增加或减少scroll_step
并time_per_frame
修改文件渲染和文件大小。
scroll_step: 15
time_per_frame: 80
scroll_step: 25
time_per_frame: 100
scroll_step: 50
time_per_frame: 50
scroll_step: 50
time_per_frame: 100
scroll_step: 50
time_per_frame: 200
您还可以在不滚动的情况下捕获页面
no_scoll: true
time_per_frame: 100
time_between_frames: 100
number_of_frames: 50
WebP 渲染将花费大量时间来受益于无损质量和文件大小优化。