| Crates.io | instafy |
| lib.rs | instafy |
| version | 0.1.0 |
| created_at | 2025-10-11 18:02:40.701494+00 |
| updated_at | 2025-10-11 18:02:40.701494+00 |
| description | Transform images into Instagram-ready 1080x1080 format with blurred backgrounds |
| homepage | https://github.com/arthurdw/instafy |
| repository | https://github.com/arthurdw/instafy |
| max_upload_size | |
| id | 1878420 |
| size | 130,981 |
Transform your images into Instagram-ready 1080x1080 format with beautiful blurred backgrounds.
tracing for debugging and monitoring# Clone the repository
git clone https://github.com/yourusername/instafy.git
cd instafy
# Build release version
cargo build --release
# Binary will be at ./target/release/instafy
cargo install instafy
Instafy supports a configuration file to set default values for all options.
Place your configuration at: ~/.config/instafy/config.yml
# Create the config directory
mkdir -p ~/.config/instafy
# Copy the example config
cp config.example.yml ~/.config/instafy/config.yml
# Edit the config file
nano ~/.config/instafy/config.yml
# Output directory for processed images
output: "./output"
# Blur intensity (sigma value)
blur: 25.0
# Output image size (width and height)
size: 2048
# Path to watermark image
watermark: "/path/to/logo.png"
# Rotate watermark for vertical images
rotate: true
# Rotation direction: "clockwise" or "counter-clockwise"
rotate_direction: "counter-clockwise"
# Watermark size: percentage ("0.15") or pixels ("200px")
watermark_size: "0.15"
# watermark_size: "200px"
All options are optional. CLI arguments always override configuration file values.
Note: Tilde (~) expansion is supported in path values (e.g., ~/path/to/file.png will be expanded to your home directory).
Settings are applied in the following order (later overrides earlier):
blur: 20.0, size: 1080, output: ./instafied, rotate: false)~/.config/instafy/config.yml)Example: If your config file sets blur: 25.0 but you run instafy ./photos -b 30.0, the blur value will be 30.0.
Process all JPG files in a directory:
instafy /path/to/images
Output will be saved to ./instafied/ by default.
instafy /path/to/images -o /path/to/output
instafy /path/to/images -b 30.0
Higher values = more blur (default: 20.0)
instafy /path/to/images -s 2048
Create 2048x2048 images instead of the default 1080x1080.
instafy ./photos -o ./instagram -b 25.0 -s 1080
Add a watermark to your images:
instafy /path/to/images -w /path/to/watermark.png
The watermark should be a PNG image with a 1:1 aspect ratio for best results.
Instafy automatically looks for a watermark at ~/.config/instafy/watermark.png. If this file exists, it will be used by default:
# Create the config directory
mkdir -p ~/.config/instafy
# Copy your watermark
cp my-watermark.png ~/.config/instafy/watermark.png
# Now just run instafy without -w flag
instafy /path/to/images
Enable automatic rotation for vertical (portrait) images using the -r flag:
instafy /path/to/images -w watermark.png -r
By default, this rotates the watermark 270° clockwise (90° counter-clockwise) for vertical images. You can change the rotation direction using the --rotate-direction flag:
# Default: counter-clockwise (270° clockwise)
instafy /path/to/images -w watermark.png -r
# Clockwise rotation (90° clockwise)
instafy /path/to/images -w watermark.png -r --rotate-direction clockwise
Control the watermark size using either percentage or pixels:
# Using percentage (default: 0.15 = 15% of canvas)
instafy /path/to/images -w logo.png --watermark-size 0.2
# Using pixels (exact size)
instafy /path/to/images -w logo.png --watermark-size 200px
Percentage format: A decimal value between 0.0 and 1.0 (e.g., 0.15 = 15% of canvas size)
Pixel format: An integer followed by "px" (e.g., 200px = exactly 200 pixels)
The watermark will be resized to a square of the specified size before being applied.
# With custom watermark
instafy ./photos -w logo.png -o ./output
# With rotation for vertical images (default: counter-clockwise)
instafy ./photos -w logo.png -r
# With rotation for vertical images (clockwise)
instafy ./photos -w logo.png -r --rotate-direction clockwise
# With custom size (percentage)
instafy ./photos -w logo.png --watermark-size 0.2
# With custom size (pixels)
instafy ./photos -w logo.png --watermark-size 250px
# Using default watermark with rotation
instafy ./photos -r
# Complete example with all options
instafy ./photos -o ./instagram -w logo.png -r --rotate-direction counter-clockwise -b 25.0 -s 1080 --watermark-size 0.15
Instafy uses the tracing library for comprehensive logging. Control log levels using the RUST_LOG environment variable:
# Default (info level) - shows progress and summary
instafy /path/to/images
# Debug mode - shows detailed processing steps
RUST_LOG=debug instafy /path/to/images
# Trace mode - maximum verbosity
RUST_LOG=trace instafy /path/to/images
# Warnings and errors only
RUST_LOG=warn instafy /path/to/images
Instafy creates Instagram-ready square images using a multi-layer approach:
Background Layer (Cover Mode):
Foreground Layer (Contain Mode):
Watermark Layer (Optional):
-r flag is used)This technique ensures your photos look professional and fit perfectly on Instagram's square format without cropping important content.
Transform images into Instagram-ready 1080x1080 format with blurred backgrounds
Usage: instafy [OPTIONS] <DIRECTORY>
Arguments:
<DIRECTORY> Path to directory containing JPG images
Options:
-o, --output <OUTPUT> Output directory for processed images
-b, --blur <BLUR> Blur intensity (sigma value) [default: 20.0]
-s, --size <SIZE> Output image size (width and height) [default: 1080]
-w, --watermark <WATERMARK> Path to watermark PNG image (defaults to ~/.config/instafy/watermark.png)
-r, --rotate Rotate watermark for vertical images
--rotate-direction <ROTATE_DIRECTION> Rotation direction: clockwise (90°) or counter-clockwise (270°) [default: counter-clockwise]
--watermark-size <WATERMARK_SIZE> Watermark size: percentage (0.15) or pixels (200px) [default: 0.15]
-h, --help Print help
-V, --version Print version
cargo build
This project uses cargo-nextest for faster test execution:
# Install nextest (if not already installed)
cargo install cargo-nextest
# Run tests
cargo nextest run
Or use standard cargo test:
cargo test
instafy/
├── src/
│ ├── main.rs # CLI interface and directory processing
│ └── lib.rs # Core image processing logic
├── Cargo.toml # Dependencies and project metadata
└── README.md
anyhow for ergonomic error propagationtracing and tracing-subscriberclap with derive macros for type-safe argument parsingContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git checkout -b feature/amazing-feature)cargo nextest run)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on GitHub.
Made with ❤️ and Rust