https://github.com/elarsaks/resize-rs
A fast, Rust-powered GitHub Action to batch-resize images by width while preserving aspect ratio.
https://github.com/elarsaks/resize-rs
github-actions image-processing rust
Last synced: 5 months ago
JSON representation
A fast, Rust-powered GitHub Action to batch-resize images by width while preserving aspect ratio.
- Host: GitHub
- URL: https://github.com/elarsaks/resize-rs
- Owner: elarsaks
- Created: 2025-06-10T18:24:56.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-08-17T11:48:15.000Z (10 months ago)
- Last Synced: 2025-08-17T13:24:16.043Z (10 months ago)
- Topics: github-actions, image-processing, rust
- Language: Rust
- Homepage:
- Size: 2.28 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Image Resizer Action
> A fast, Rust-powered GitHub Action to batch-resize images by width while preserving aspect ratio.

## 🎨 Example Output
From left to right: the original image (1024 px) is resized down to 256 px, 128 px, and 64 px.
## 📦 Usage
In your workflow, reference this action and supply the folder of source images, desired widths, and an output folder:
## [📖 Example Workflow ](https://github.com/elarsaks/resize-rs/blob/master/.github/workflows/resize-images.yml)
```yaml
name: Resize App Images
on:
push:
branches: [master] # Trigger on pushes to master branch
workflow_dispatch: # Allow manual runs from the Actions tab
# Grant write permission so the workflow can commit back to the repo
permissions:
contents: write
jobs:
resize:
runs-on: ubuntu-latest
steps:
# 1. Checkout the repo so we can read/write files
- name: Check out code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }} # Provides auth for checkout & push
persist-credentials: true # Keep token in Git config for commits
# 2. Configure a Git user so commits have a valid author
- name: Configure Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# 3. Run the custom resize action
- name: Resize images
uses: elarsaks/resize-rs@v0.1.1
with:
source-dir: assets/original # Source directory of original images
sizes: "64,128,256" # Target resize dimensions
output-dir: assets/resized # Where resized images are saved
# 4. Commit & push only if new/resized files exist
- name: Commit & push resized files
run: |
git add assets/resized
git diff --cached --quiet || ( # Check for staged changes
git commit -m "ci: add resized images"
git push # Push commits to the triggering branch
)
```
## 🔧 Inputs
| Input | Description | Required | Default |
|--------------|---------------------------------------------|:--------:|:-------:|
| `source-dir` | Directory containing original images | true | — |
| `sizes` | Comma-separated list of target widths (px) | true | — |
| `output-dir` | Directory where resized images will be saved| true | — |
## 🛠️ Outputs
It writes resized files into `output-dir`.
## 📄 License
[MIT](LICENSE) © Elar Saks