oliframe

Crates.iooliframe
lib.rsoliframe
version0.2.2
sourcesrc
created_at2024-01-16 11:56:04.40443
updated_at2024-11-05 06:51:00.978404
descriptionAdd a simple border to one or more images
homepagehttps://github.com/calteran/oliframe
repositoryhttps://github.com/calteran/oliframe
max_upload_size
id1101528
size1,762,821
Calteran (calteran)

documentation

https://docs.rs/oliframe

README

oliframe

oliframe crates.io codecov MIT license

Oliframe is a command-line tool written in Rust to add simple colored frames (borders) around images. It is designed to efficiently batch process images with a consistent border style. Flexible options allow for customization of the border width, color, and corner radius.

This project was inspired by the style of posts by @officialmumbo on Instagram, but is not endorsed by or affiliated with him.

Installation

$ cargo install oliframe

Usage

$ oliframe --help
Usage: oliframe [OPTIONS]

Options:
  -v, --verbose  Verbose output
  -q, --quiet    Quiet output -- suppresses everything except errors
  -h, --help     Print help
  -V, --version  Print version

Input Options:
  -i, --input <FILE_OR_DIR>  One or more input file_collector or directories, if not specified, the current directory is used
  -R, --recursive            Recursively search for input file_collector in the specified director(y/ies)
  -x, --extension <XTN>      File extensions(s) to accept (must be exact match, i.e.: "jpg" != "jpeg" != "JPG")

Output Options:
      --dry-run               Dry run (don't create output file_collector)
  -o, --output <FILE/FOLDER>  Output destination. If skipped, each output file will be saved in the same directory as the input file
  -f, --flatten               Flatten the output directory structure when processing multiple input file_collector
  -p, --prefix <PREFIX>       Prefix to prepend to output file_collector
  -s, --suffix <SUFFIX>       Suffix to append to output file_collector
  -y, --overwrite             Overwrite existing files.  Defaults to no

Framing Options:
      --ar <RATIO>           Fix the final aspect ratio of the output image. Specify the ratio as a fraction (e.g.: "16:9") or a decimal (e.g.: "1.777")
  -c, --color <COLOR>        Color of the border/background.  Specify any valid CSS color [default: white]
  -r, --radius <RADIUS>      Add rounded corners to the image.
  -m, --margins <SIZE(S)>    Relative margins around the image, as a percentage of (width + height) / 2. Specify one to four values, separated by commas, in CSS order
  -P, --position <POSITION>  Relative position of the input image within the output image. Horizontal values: "left", "center", "right" Vertical values: "top", "center", "bottom"

Examples

The default behavior is to add a white border that's 5% of the image size to all images in the current directory. Oliframe will not overwrite existing files by default, so you must use the -y flag to allow overwriting.

$ oliframe -y

Example 1


Rounded corners can be added by specifying a radius. Instead of editing in place, you can optionally specify an output directory with the -o flag.

$ oliframe --radius 20 -o framed_images

Example 2


More complex borders can be created by specifying the color, final aspect ratio, and position of the image within the frame.

$ oliframe --color darkslategray --ar 1:1 --position bottom-left -m 10,50,10,10

Example 3

Roadmap / Future Functionality

  • Add option (-W, --watch) to watch for changes in a directory and automatically add borders to new images

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

AI-Assisted Development

This project has been developed with the assistance of AI-powered tools, including ChatGPT and GitHub Copilot. These tools have contributed to various aspects of the code, ranging from generating initial code snippets to offering suggestions for code optimization and bug fixes. While these tools have aided in the development process, the design and implementation of this project is the work of the author.

Commit count: 163

cargo fmt