| Crates.io | rustant-film |
| lib.rs | rustant-film |
| version | 0.2.1 |
| created_at | 2025-01-18 04:23:55.236037+00 |
| updated_at | 2025-03-31 08:30:14.346773+00 |
| description | Add a instant film style layout to your photo by EXIF. |
| homepage | https://github.com/BlankZhu/rustant-film |
| repository | https://github.com/BlankZhu/rustant-film |
| max_upload_size | |
| id | 1521344 |
| size | 146,734 |
Add an instant-film-style layout to your EXIF photos.
| index | layout | image |
|---|---|---|
| 1 | Diagonal, pos left with paddings | |
| 2 | Diagonal, pos right | |
| 3 | Duel, pos left | |
| 4 | Duel, pos right with paddings | |
| 6 | Triangular, pos bottom with paddings | |
| 7 | Triangular, pos bottom |
To get rustant-film, use:
cargo install rustant-film
Or to build it from source:
cargo build --release
It's recommended to clone this repository and go through the next tutorial section.
To get some materials to develop a good image result, you should prepare your own fonts and logos. You can find a example material setup scripts in setup-example
Then run the following command to setup some essential meterials:
# You may need to install some commands used by the scripts, such as 'wget', 'unzip', and 'convert'.
sh ./setup-example/font.sh
sh ./setup-example/logo.sh
sh ./setup-example/sample.sh
This will generate example fonts, logos, and a sample photo under the ./resources directory.
Finally, run the following command:
rustant-film -i ./resources/samples -o ./output -f ./resources/font/ttf/FiraCode-SemiBold.ttf -l ./resources/logos
The output will be saved in the ./output directory.
For a more detailed guide on preparing media resources, refer to here.
Currently, rustant-film supports the following layouts:
triangle: A traditional instant film layout with EXIF information displayed below.blank: A raw instant film with only blank paddings, no extra info added.duel: A layout with EXIF information displayed on left or right.diagonal: A layout like duel by display EXIF information on top-left or bottom-right.rustant-film -i ./resources/samples -o ./output -f ./resources/font/ttf/FiraCode-Regular.ttf -l ./resources/logos -p triangle
For a more classic instant film style, add padding around by using flag -pad:
rustant-film -i ./resources/samples -o ./output -f ./resources/font/ttf/FiraCode-Regular.ttf -l ./resources/logos -p triangle --pad
Some layout may use a sub-font to get a better look. To use a sub-font, use --sub-font:
rustant-film -i ./resources/samples -o ./output -f ./resources/font/ttf/FiraCode-SemiBold.ttf --sub-font ./resources/font/ttf/FiraCode-Regular.ttf -l ./resources/logos -p triangle --pad
In addition to the command-line interface, rustant-film can also operate as an HTTP server. This allows you to generate and download files via RPC.
To run rustant-film in server mode, use the command like:
rustant-film -m server -f ./resources/font/ttf/FiraCode-SemiBold.ttf --sub-font ./resources/font/ttf/FiraCode-Regular.ttf
Once the server is running, you can send requests to the API. For example, to process an image, use the following curl command:
curl --output result.jpg 'http://0.0.0.0:6400/api/v1/develop?painter=diagonal&pad=false&pos=r' \
-X POST \
-H "Content-Type: multipart/form-data" \
-F 'image=@./test.jpg'
This will generate and return the processed image as result.jpg.
rustant-film aims to implement the following features in future versions:
More Layout: Additional instant film layout options.Adaptive Layout: Automatically adjusts the layout for photos with missing EXIF data.Watermark: Adds watermarks, including invisible ones, to processed photos.Copyright Support: Allows users to add custom copyright information, such as the artist's name, to the final photo.Async HTTP API: Hosts the rustant-film command as an HTTP API server, providing asynchronous APIs.GUI: Add a GUI for rustant-film, maybe as a new project.Container Image: Distributes the rustant-film command-line tool and HTTP API as a container image.Cargo Binary Publishing: Publishes the rustant-film command as a binary on crates.io.Lens Logo Support: Some layouts may include lens logos.rustant-film will add instant film layout to the following images in showcase.