2.8 KiB
[WIP] minna-pima
Picture manager intended for usage with Minna.
minna-pima
integrates with minna-caos
to provide picture management features.
Similarly to the latter, it is intended as a companion to a single application (“the app”) that has full authority.
Features
-
automatic conversion of unwanted file formats
-
ThumbHash generation
-
on-demand resizing and format conversion (without caching, see below)
-
similarity search for finding duplicates
-
CLI for administrative tasks
Notes
Pictures are not cached
minna-pima
does not cache the pictures it generates on-demand.
This is by design: Caching is hard and better left to tools designated for this purpose.
It is therefore recommended to use a caching reverse-proxy in front of minna-pima.
Example picture upload flow
-
The client uploads a PNG file to
minna-caos
in cooperation with the app. -
Because
minna-caos
detected that the file is a PNG image, the app decides to useminna-pima
. -
The app sends a
GET /objects/ORIGINAL_UPLOAD_HASH/similar
request tominna-pima
:minna-pima
fetches the object’s content and media type fromminna-caos
.minna-pima
computes a perceptual hash of the picture and uses it to search its database for similar pictures.- It finds two matching pictures and returns the following result:
{ "similar_picture_ids": ["abc123", "def456"] }
-
The app notifies the client that there are similar pictures.
-
The user decides that…
- the first picture is unrelated, and
- the second picture is a lower-quality version of the uploaded picture and should be replaced by the higher-quality version.
-
The client notifies the app of the user’s decision.
-
The app creates a new upload through
minna-caos
. It’s ID isCONVERTED_UPLOAD_ID
. -
The app sends a
POST /pictures/
request tominna_pima
with the following payload:{ "hash": "ORIGINAL_UPLOAD_HASH", "upload_id": "CONVERTED_UPLOAD_ID", "replaces": ["def456"] }
minna-pima
fetches the content and the media type of the object fromminna-caos
.minna-pima
generates a ThumbHash and converts the picture to AVIF because PNG is not in the list of allowed source formats.minna-pima
uploads the picture tominna-caos
usingPATCH /uploads/CONVERTED_UPLOAD_ID
.
-
The app waits for the
CONVERTED_UPLOAD_ID
upload to finish. The new picture’s ID is alsoCONVERTED_UPLOAD_ID
.A 100×100 WebP version can be fetched from
/pictures/CONVERTED_UPLOAD_ID/100x100.webp
.