An open API service indexing awesome lists of open source software.

https://github.com/josepmedialdea/backdrop

๐Ÿ–ผ๏ธ CLI tool that fills transparent image backgrounds with a solid color. Supports local files, URLs, and emoji input.
https://github.com/josepmedialdea/backdrop

cli emoji go golang image-processing transparency

Last synced: 3 months ago
JSON representation

๐Ÿ–ผ๏ธ CLI tool that fills transparent image backgrounds with a solid color. Supports local files, URLs, and emoji input.

Awesome Lists containing this project

README

          





backdrop


CLI tool that fills transparent image backgrounds with a solid color.


Features
ยท
Installation
ยท
Usage
ยท
Examples

## About

backdrop takes an image with a transparent background โ€” a local file, URL, or emoji โ€” and fills it with a solid color.

I built this to generate consistent project avatars for GitLab, but it works anywhere you need a quick, polished image with a colored background โ€” favicons, social cards, README badges, etc.

## Features

- **Multiple input sources** โ€” local files, HTTP(S) URLs, or emoji (e.g. `๐Ÿ `)
- **Flexible color input** โ€” hex (`#FF5733`) or RGB (`255,87,51`)
- **Square mode** โ€” force output to a perfect square
- **Padding** โ€” add breathing room in pixels (`--padding 20`) or as a percentage of the image (`--padding 10%`)

## Installation

### Homebrew

```sh
brew install josepmedialdea/tap/backdrop
```

### From source

```sh
git clone https://github.com/josepmedialdea/backdrop.git
cd backdrop
make build
# binary is at ./bin/backdrop
```

### Go install

```sh
go install github.com/josepmedialdea/backdrop/cmd/backdrop@latest
```

## Usage

```
backdrop [flags]
```

### Flags

| Flag | Short | Default | Description |
|------|-------|---------|-------------|
| `--color` | `-c` | `#000000` | Background color as hex (`#rrggbb`) or `R,G,B` |
| `--output` | `-o` | auto | Output file path (default: `_bg.`) |
| `--force` | | `false` | Overwrite output file if it already exists |
| `--square` | | `false` | Make output image a perfect square |
| `--padding` | | `0` | Padding on all sides: pixels (e.g. `20`) or percentage (e.g. `10%`) |

## Examples

```sh
# Fill a local PNG with a blue background
backdrop logo.png -c "#3498db"

# Fetch an image from a URL and apply a red background
backdrop https://example.com/icon.png -c 255,0,0

# Render an emoji with a dark background
backdrop ๐Ÿฆž -c "#1a1a2e"

# Square output with 10% padding
backdrop logo.png -c "#2ecc71" --square --padding 10%

# Explicit output path, overwrite if exists
backdrop logo.png -c "#000000" -o result.png --force
```

## License

[MIT](LICENSE)