elswork/cwebp

By elswork

Updated over 4 years ago

Image

786

cwebp

A Docker file to call cwebp and other functions from libwebp library.

Be aware! You should read carefully the usage documentation of every tool!

Details

Docker PullsDocker StarsSize/Layers

Compatible architectures

This image has been builded using buildx for this architectures:

  • amd64 arm64 ppc64le s390x 386 arm/v7 arm/v6

Usage Example

Open ash in container
docker run -it --rm -v /path-to-folder:/data --entrypoint "/bin/ash" elswork/cwebp 

or

make console

p.e. I've included some .png and .jpg files for testing purposes in "data" folder:

make console DIR="$$(pwd)/data"
  • You can set your local folder (DIR) that will be mounted in container, p.e. "/home/user/pictures"

Start a custom command in container
docker run -it --rm -v /path-to-folder:/data elswork/cwebp cwebp -lossles deftwork.png -o deftwork.webp

or

make custom

p.e. I've included some .png and .jpg files for testing purposes in "data" folder:

make custom DIR="$$(pwd)/data" PARAM="cwebp -lossles deftwork.png -o deftwork.webp"
  • You can use change the command in (PARAM) dwebp, gif2webp, ... instead of cwebp.

Start a container command
docker run -it --rm -v /path-to-folder:/data elswork/cwebp cwebp -lossles deftwork.png -o deftwork.webp

or

make start

p.e. I've included some .png and .jpg files for testing purposes in "data" folder:

make start DIR="$$(pwd)/data" OPT="-lossless" FILE="deftwork" EXT="png"
  • You can change options (OPT) with "-q 70", "-sns 70 -f 50 -size 60000", ... "-lossless" (default).
  • You must set extension (EXT) forn "jpg", "tiff", ... for other extensions than "png" (default).

Convert all .png from folder and subfolders recursively
docker run -it --rm -v /path-to-folder:/data elswork/cwebp \
find ./ -type f -name '*.png' -exec sh -c 'cwebp -lossless $1 -o "${1%.png}.webp"' _ {} \;

or

make bulk

p.e. I've included some .png and .jpg files for testing purposes in "data" folder:

make bulk DIR="$$(pwd)/data" OPT="-lossless" EXT="png"
  • Same parameters than previous operation.

Convert all .png concurrently

This is faster than previous operation because it raise concurrent threads.

docker run -it --rm -v /path-to-folder:/data elswork/cwebp \
find ./ -type f -name '*.png' | xargs -P 8 -I {} sh -c 'cwebp -lossless $1 -o "${1%.png}.webp"' _ {} \;

or

make concurrent

p.e. I've included some .png and .jpg files for testing purposes in "data" folder:

make concurrent DIR="$$(pwd)/data" OPT="-lossless" EXT="png"
  • Same parameters than previous operation.
  • The number of concurrent threads is 8.

Sponsor me! Together we will be unstoppable.

Docker Pull Command

docker pull elswork/cwebp