Home

Awesome

website-to-gif GitHub release (latest by date) GitHub

<p align="center"> <img src="docs/images/ss_15_tps_80.gif"> </p> <p align="center"> <b>This Github Action automatically creates a animated GIF or WebP from a given web page to display on your project README (or anywhere else).</b> </p>

Usage

In your GitHub repo, create a workflow file or extend an existing one. (e.g. .github/workflows/gif.yml)

You have to also include a step to checkout and commit to the repo. You can use the following example gif.yml. Make sure to modify the url value and add any other input you want to use.

.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.5
        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

See official GitHub doc to further customize your workflow.

Inputs

NameDescriptionDefaultExample
urlWeb page URL to be captured. Requiredurl: "https://docs.github.com"
save_pathFile saving path, starts with /. Make sure the path you provide already exists as this action will not create any directory.repo rootsave_path: "/docs/images/"
file_formatOutput file format, currently support GIF and WebPGIFfile_format: "WebP"
file_nameFile name, do not include extension or pathdemofile_name: "ss_25_tps_100"
window_widthBrowser window width1920 (px)window_width: 1366
window_heightBrowser window height1080 (px)window_height: 768
stop_yPosition where file capture should stopbottom of pagestop_y: 800
start_yPosition where file capture should start0 (px)start_y: 1024
final_widthFinal file width640 (px)final_width: 1024
final_heightFinal file height360 (px)final_height: 576
scroll_stepNumber of pixels by scroll25 (px)scroll_step: 50
time_per_frameMilliseconds per frame100 (ms)time_per_frame: 200
start_delayNumber of milliseconds to wait for before starting capture0 (ms)start_delay: 100
no_scollCapture GIF without page scroll, will discard any scroll related parameterfalseno_scoll: true
time_between_framesNumber of milliseconds between frame captures if no_scroll is true100 (ms)time_between_frames: 200
number_of_framesNumber of frames to be captured if no_scroll is true20number_of_frames: 50
resizing_filterFilter used to resize frames, see https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=resize#PIL.Image.Image.resizeLANCZOSresizing_filter: "LANCZOS"

Examples

Increase or decrease scroll_step and time_per_frame to modify file rendering and filesize.

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

You can also capture pages without scrolling

no_scoll: true time_per_frame: 100 time_between_frames: 100 number_of_frames: 50

WebP

WebP rendering will take a lot of time to benefit from lossless quality and file size optimization.

Contributing

Feel free to contribute! To suggest a new feature, report a bug or offer your help, simply open a new issue.