2 releases
new 0.1.1 | Jan 18, 2025 |
---|---|
0.1.0 | Jan 18, 2025 |
#49 in Images
67KB
1.5K
SLoC
rustant-film
Add an instant-film-style layout to your EXIF photos.
Samples
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 |
Features
- Written in Rust.
- Provides both command line & server API.
- Customizable logo & font.
- Cross-platfrom by cargo.
Quick Start
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.
Tutorial
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.
Layouts
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 likeduel
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
Server
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
.
Roadmap
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 therustant-film
command as an HTTP API server, providing asynchronous APIs.GUI
: Add a GUI forrustant-film
, maybe as a new project.Container Image
: Distributes therustant-film
command-line tool and HTTP API as a container image.Cargo Binary Publishing
: Publishes therustant-film
command as a binary on crates.io.Lens Logo Support
: Some layouts may include lens logos.
Credit
Sample Fonts
- "FiraCode" by Nikita Prokopov, used under OFL-1.1 license.
Sample Images
rustant-film
will add instant film layout to the following images in showcase.
- "Dahlia-in-bloom" by Changku88, used under CC BY-SA 4.0.
- "Kranhäuser Cologne, April 2018-01" by Martin Falbisoner, used under CC BY-SA 4.0.
- "Dendermonde town hall and belfry during golden hour" by Trougnouf, used under CC BY-SA 4.0.
- "Annunciazione Santuario del Carmine San Felice del Benaco" by Wolfgang Moroder, used under CC BY-SA 4.0.
- "Boat passing under Elgin Bridge during blue hour (2023)" by Frank Schulenburg, used under CC BY-SA 4.0.
- "Puppy de Jeff Koons -- 2021 -- Bilbao, España" by Jose María Ligero Loarte, used under CC BY-SA 4.0.
- "Love padlocks on the Butchers' Bridge (Ljubljana)" by Petar Milošević, used under CC BY-SA 4.0.
- "Akelei Blüte geschlossen stacking-20230506-RM-120202" by Ermell, used under CC BY-SA 4.0.
- "Parboiled rice with chicken, peppers, cucurbita, peas and tomato" by Petar Milošević, used under CC BY-SA 4.0.
- "York Railway Museum in Evening Lights - Pastel Theme" by Nedian91, used under CC BY-SA 4.0.
- "D-6-73-141-83 Sühnekreuz in der Merklach 3" by Stephan van Helden, used under CC BY-SA 4.0.
- "Khairdeen urf Pritam, Black and White" by Satdeep Gill, used under CC BY-SA 4.0.
Dependencies
~22–31MB
~543K SLoC