atonamy/images-to-webp-m

Convert a ZIP of ordered PNG/WebP frames into a WebM or WebP animation using ffmpeg, with quality, frame-rate, and size controls.

Public
26 runs

Run time and cost

This model runs on CPU hardware. We don't yet have enough runs of this model to provide performance information.

Readme

Animated Sticker Pipeline (images-to-webm-p)

Turn sequential frame images into compact WebM or animated WebP loops. This model was built to streamline sticker creation workflows for chat platforms such as Telegram (WebM/VP9) and WhatsApp (animated WebP). If your own project needs quick image-to-video batching, you can use it the same way.

How It Works

Upload a stack of images and pick your output container. The predictor stitches the frames, enforces consistent sizing, and runs ffmpeg with tuned defaults to produce a sticker-ready animation. Alpha channels in PNG input frames are preserved in both formats.

Inputs

Name Type Default Range Description
images_zip file (ZIP) none none ZIP bundle of .png or .webp frames. Archive entries are filtered for those extensions and sorted in natural order before rendering.
output_format string webm webm | webp Container/codec for the animation.
quality float 70 0-100 Higher values give better quality and larger files.
frame_rate int 16 1-30 Playback speed in frames per second.
size string 512x512 8x8-4096x4096 Target resolution. Frames are resized to this width x height.

Outputs

Returns a single animation file (.webm or .webp) ready for upload to sticker platforms or further processing.

Example Usage

CLI (Cog)

Gather your sequential frames under frames/ (PNG or WebP only) and create an archive:

zip -r frames.zip frames/

Run the predictor on the ZIP bundle:

cog predict \
  -i images_zip=@frames.zip \
  -i output_format=webm \
  -i frame_rate=18 \
  -i quality=60 \
  -i size=512x512

Need an animated WebP instead? Change the format (other knobs work the same way):

cog predict \
  -i images_zip=@frames.zip \
  -i output_format=webp \
  -i frame_rate=24 \
  -i quality=80 \
  -i size=512x512

The predictor extracts the archive safely, ignores Finder metadata, and orders frames using natural sorting (frame2 before frame10). Direct multi-file uploads and manifests are no longer supported.

HTTP API (Replicate)

curl -s -X POST https://api.replicate.com/v1/predictions \
  -H "Authorization: Token $REPLICATE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "version": "<latest-version-id>",
    "input": {
      "images_zip": "data:application/zip;base64,${BASE64_OF_FRAMES_ZIP}",
      "output_format": "webp",
      "quality": 70,
      "frame_rate": 20,
      "size": "512x512"
    }
  }'

Download the result URL from the prediction output once it completes.

Tips for Stickers

  • Telegram expects transparent VP9 WebM: stick with output_format=webm, keep the resolution <= 512x512, and consider frame_rate=30 to stay smooth.
  • WhatsApp prefers animated WebP: use output_format=webp, keep size <= 512x512, and dial quality down (for example, 60) if the exported file is too large.
  • If your source frames are not square, resize first—this model enforces a single width x height.
  • Keep sequences short (Telegram and WhatsApp limit duration and file size); reduce frame_rate or crop the frame set to tighten loops.

Extensibility

Beyond stickers, you can reuse this pipeline for GIF replacements on the web, quick previews of animation frames, or any workflow that needs a deterministic image-to-video batch step. Adjust the defaults and parameters as needed for your format requirements.


Made with Cog and ffmpeg to bring repeatable sticker conversion to your pipeline.