Skip to content
This repository has been archived by the owner on Sep 23, 2022. It is now read-only.
/ webp-utils Public archive

Wrapper around webp cli tools to allow easier batch processing and automation

License

Notifications You must be signed in to change notification settings

timo-reymann/webp-utils

Repository files navigation

webp-utils

GitHub Release Go Report Card CircleCI Build Status codecov Renovate

Wrapper around webp cli tools to allow easier batch processing.

Currently supported webp cli tools:

  • cwebp
  • gif2webp

Technical notes

For easier development a json schema is used as base for validation and paramter passing.

Install

Binary

IMPORTANT: webcp tools must be installed!

To use the tools with a binary you will also need to install the webp cli tools yourself.

Just make sure they are placed inside your PATH or add them accordingly.

More information about installation can be found on developers.google.com.

Get binary using go cli

If you already have go setup you can simply run a go get:

go get -u github.com/timo-reymann/webp-utils

Get binary from GitHub release

Navigate to the latest release and download the binary for your platform.

Docker

If you want to use docker:

e. g. for cwebp

docker run --user $(id -u):$(id -g) -v $PWD:/workspace --rm -it timoreymann/webp-utils \
    cwebp --config /etc/webp-utils/default.json --file-glob '*.png'

Usage

  1. OPTIONAL: Setup schema for your IDE, for available schemas look into pkg/schema
  2. Create a file named config.json, containing all parameters for the command you want to execute, you can also create a file named differently and use the --config-Flag
  3. Run the command and specify a file glob for the files to be processed, like this: webp-utils cwebp --file-glob '*.png'

Configuration file

Each json key value pair represents an argument and its value, that can be templated using go templates. You can also use the template functions from sprig as documented here.

You can use any other key or the following builtins:

Name Content
source_file Source file path with extension
source_file_name Source file name without extension

You can find all schemas inside pkg/schema, you can also set up your ide/editor to give you autocomplete based on the json schema.

Examples

Feel free to browse around at examples

About

Wrapper around webp cli tools to allow easier batch processing and automation

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published