Lust is a static image server designed to automatically convert uploaded image to several formats and preset sizes

Overview

Lust Logo

What is Lust?

Lust is a static image server designed to automatically convert uploaded image to several formats and preset sizes with scaling in mind.

Lust stores images via any of given database backends:

  • Redis / KeyDB
  • Cassandra / ScyllaDB
  • PostgreSQL
  • MySQL / MariaDB
  • Sqlite (file / temp file only)

Getting started

Installation

Building from Source

To building from source, just clone this repo via git clone https://github.com/chillfish8/lust.git and then run cargo build --release.

Docker Images

Lust has a set of pre-built, optimised docker images ready to go, they just require having a config.json attached to them and away you go.

Example Dockerfile:

FROM chillfish8/lust:latest

ADD ./config.json /etc/lust/config.json

You can run the image via docker run, you may wish to expose your set ports etc...

After Installation

See the getting started page for more information after installation.

Caching

Lust makes use of a Least Recently Used in-memory cache which can be adjusted for your needs via the cache_size key in the configuration file. The larger the number the more images it will cache at once and vice versa. NOTE: With bigger images this can create much higher RAM usage

Scaling

Lust's ability to scale is purely down to the backend you use, something like SQLite will obviously suffer at any sort of scale and is meant only really for development purposes. Personally I recommend PostgreSQL (leading to vertical scaling storage) or Scylla (Horizontally scaling storage) depending on your needs. If you want a very small amount of cached images then Postgres will out perform Scylla considerably at random reads however, Scylla is far more suites to large scaling and distributed system as well as large amounts of writes.

Performance of each database generally doesn't matter too much due to the processing time of each image being more than the IO latency when adding images and the cache supporting reads, that being said if you have a lot of random inconsistent reads PostgreSQL will likely be the best, or if you want large distributed scaling Scylla will allow you to scale horizontally.

If you want the best of both worlds I would recommend looking at KeyDB (Redis) with disk persistence, when setup correctly this can be an incredibly powerful setup.

Formats

Lust supports any of the following formats:

  • Png
  • JPEG
  • GIF
  • Webp

Any uploaded images will be given a unique uuid and be re-encoded into all the other enabled formats in all presets. This is especially useful when you want to serve several variants of the same image with different formats.

Presets

The server can take several sizing presets which can be targeted via the size query parameter when getting an image. These presets will mean every image at upload time will be resized to fit the width and height bounds using the nearest approximation.

Regardless of presets an original image is always stored and can be accessed via the size=original query. The default preset when served without a sized parameter can be set in the configuration file via default_serving_preset key.

Webp Optimisation

Lust supports automatic webp encoding, by default it encodes with lossless compression but this can be changed via the webp_quality key in the configuration file and should be a float from 0.0 to 100.0 with the quality of the image changing respectively.

Base64 Support

Lust will serve given images / gifs as Base64 data the encode query parameter (true/false) this will return a JSON response unlike the tradition raw response.

Data Efficiency

Lust's data storage efficiency is roughly the same as storing on a plain file system outside of any system the database backend employs when storing the data.

For example lets upload an image:

Medium image

This image is about 91KB in size as a single image, If we upload this and convert to the 3 base image formats with some presets:

{
  'data': {
    'file_id': 'ccbe2207-8629-4938-9da9-3f75706f9b4e',
    'formats': {
      'large': {     // Resized to 128px x 128px
        'jpeg': 3460,
        'png': 5292,
        'webp': 3006
      },
      'medium': {   // Resized to 64px x 64px
        'jpeg': 1543, 
        'png': 1738, 
        'webp': 1022
      },
      'original': {   
        'jpeg': 42846,
        'png': 103672, 
        'webp': 53982
      },
      'small': {    // Resized to 32px x 32px
        'jpeg': 912, 
        'png': 629, 
        'webp': 354
      }
  },
  'status': 200
}

We can see with the original size totals around 200KB which is is fairly reasonable with zero compression PNG encoding and lossless webp formats.

Issues
  • Create LICENSE

    Create LICENSE

    opened by ChillFish8 0
  • Moment of Instalition

    Moment of Instalition

    opened by MrKomodoDragon 0
  • remove git poisoning and add logging to error silencing when requesti…

    remove git poisoning and add logging to error silencing when requesti…

    remove git poisoning and add logging to error silencing when requesting images.

    backend 
    opened by ChillFish8 0
  • Redis support

    Redis support

    backend enhancement 
    opened by ChillFish8 0
  • [ 🌠 Feat ] Dynamically load extensions

    [ 🌠 Feat ] Dynamically load extensions

    Currently, Lust is shipped as one big binary with some 500+ dependencies, this is rather large and leads to a lot of dependencies that most people using Lust for will never use if they only use one storage backend.

    A solution is to dynamically load backends from DLLs, this would allow a user to build/download their given backend(s) and load them from the main server rather than having to have all the other backends shipped to them.

    This would also allow a more pluggable experience for developing extensions etc...

    backend breaking change enhancement 
    opened by ChillFish8 0
  • CQL performance issues

    CQL performance issues

    Currently, Lust supports Cassandra via its scylla DB driver, while this system works logically it is currently prone to timeouts depending on the data and setup. This might be an issue with the testing database or more likely my less than perfect CQL knowledge leading to in-efficient queries.

    backend bug help wanted 
    opened by ChillFish8 0
  • [ 🌠 Feat ] Prometheus metrics support

    [ 🌠 Feat ] Prometheus metrics support

    At the moment the server has no real way of providing metrics to the user which may be an issue for some who want monitoring, or at least is a large inconvenience to do.

    A Prometheus endpoint would allow things like Grafana dashboards to make life much easier to produce monitoring for.

    enhancement help wanted 
    opened by ChillFish8 0
Releases(1.1.0)
Owner
Harrison Burt
17yr/o Programmer in Python, Rust, Js and Go lang.
Harrison Burt
Encoding and decoding images in Rust

Image Maintainers: @HeroicKatora, @fintelia How to contribute An Image Processing Library This crate provides basic image processing functions and met

image-rs 2.2k Jun 13, 2021
🎨 Example-based texture synthesis written in Rust 🦀

?? texture-synthesis A light Rust API for Multiresolution Stochastic Texture Synthesis [1], a non-parametric example-based algorithm for image generat

Embark 1.4k Jun 12, 2021
Image Compression Algorithm

Image Compression Algorithm ?? A new lossless image compression algorithm. In the newest version the algorithm performs rather good, but manages to su

Hannes 16 Jun 3, 2021
Converts images into textual line art.

img2utf Transform images to textual line art! Images require pre-processing to come out nice. It's expected that users will do the following: Apply ga

Lee 144 Apr 6, 2021
Image processing operations

imageproc An image processing library, based on the image library. There may initially be overlap between the functions in this library and those in i

image-rs 364 Jun 15, 2021
Rust bindings for OpenCV 3 & 4

Rust OpenCV bindings Experimental Rust bindings for OpenCV 3 and 4. The API is usable, but unstable and not very battle-tested; use at your own risk.

null 662 Jun 5, 2021
Convert and save photomode screenshots from Red Dead Redemption 2 to JPEG format.

RDR2 Screenshot converter Convert and save photomode screenshots from Red Dead Redemption 2 to JPEG format. QuickStart Just download the executable fi

Timofey Gelazoniya 12 May 6, 2021
tai (Terminal Ascii Image) tool to convert images to ascii written in Rust

TAI Terminal Ascii Image A tool to convert images to ascii art written in Rust ?? Notes This tool is still in development stage. Contributions All Con

Mustafa Salih 185 Jun 13, 2021
resvg is an SVG rendering library.

resvg can be used as a Rust library, a C library and as a CLI application to render SVG files based on a static SVG Full 1.1 subset.

Evgeniy Reizner 1k Jun 15, 2021
A simple steganography library written in rust

steganography A stable steganography library written in rust Crates.io Usage Add the following to the Cargo.toml in your project: [dependencies] stega

Teodor Voinea 60 May 21, 2021
Face detection library for the Rust programming language

Rustface SeetaFace detection library for the Rust programming language Example of demo program output SEETAFACE C++ – Github repository for the origin

Andrei Tomashpolskiy 274 May 9, 2021
Zero dependency images (of chaos) in Rust

bifurcate-rs Zero dependency images (of chaos) in Rust To run: time cargo run --release > img.pgm To convert from PGM to PNG using Image Magick: conve

Stephen Merity 32 Mar 21, 2021
Rust CV mono-repo

Rust CV Rust CV is a project to implement computer vision algorithms, abstractions, and systems in Rust. #[no_std] is supported where possible. Docume

Rust Computer Vision 129 Jun 8, 2021
Slideo: This tool uses OpenCV to automatically synchronize slides with videos that show these slides.

This tool matches video frames against PDF pages by using computer vision. It also ships a web app in which you can click on a PDF page to play the video from the first frame showing the page. Its primary use-case is to quickly play a recorded lecture from a given slide.

Henning Dieterichs 62 May 30, 2021