Skip to content

Repository files navigation

image

maple allows you to composite images/text with templates into animated GIFs or Videos.

CodSpeed

Install

You can download the maple CLI from the releases page.

If you want to build it for some reason, run: cargo install --path . Requires Rust 1.88+. Video and GIF output require ffmpeg and libwebp respectively.

Using the crate

The crate maple-render-core will allow you to render images/text with templates into animated GIFs or Videos programmatically in rust. See http://docs.rs/maple-render-core for documentation.

CLI Usage

maple --zip <template.zip> --in <image.png> --gif out.gif

Output

FlagDescription
--gif <path>Animated GIF
--webp <path>Animated WebP
--webp-single <path>Single-frame WebP
--vid <path>Video (ffmpeg required)
--save "frame_%06d.jpg"Individual frames
--singleSingle frame only

WebP output defaults to lossy quality 95 and compression method 4. Use --webp-quality <0..100>, --webp-method <0..6>, or --webp-lossless to override it.

Transform

FlagDescription
-w/-HOutput dimensions
--auto_zoomAuto-fit content
--start <n>Starting frame offset
--first/--lastFrame range

Text

FlagDescription
--in "text:Hello"Text as image layer
--font_size <n>Size (default: 72)
--text_color "FF0000"Hex color
--text_bg "FFFFFF"Background hex

Multi-layer

--in img1.png img2.png # Layers 1, 2
--in img1.png +img1b.png # Both on layer 1

JSON Config

maple --json config.json

Examples

# Photo to toaster GIF
maple --zip templates/toaster.zip --in photo.jpg --gif out.gif
# Full-color animated WebP
maple --zip templates/toaster.zip --in photo.jpg --webp out.webp
# Text billboard
maple --zip templates/billboard-cityscape.zip --in "text:SALE" --gif ad.gif
# Book cover + back
maple --zip templates/book.zip --in front.png back.png --vid book.mp4

Benchmarks

Template parsing, frame compositing, color quantization and GIF/WebP encoding are benchmarked with divan in benches/ and tracked on every push and pull request by CodSpeed.

# Wall-clock numbers
cargo bench
# Same benchmarks, measured the way CI measures them
cargo install cargo-codspeed --version 5.0.1 --locked
cargo codspeed build --profile codspeed --measurement-mode walltime --locked
cargo codspeed run --measurement-mode walltime

License

MIT

About

🍁 Composite images/text into animated templates

Resources

Stars

28 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages