Skip to content
/ aerial Public

Proof of concept of getting dominant colors in images and each page of a docx or pdf file using kmeans_colors and mupdf. Rendered using sveltekit framework.

Notifications You must be signed in to change notification settings

lnfel/aerial

Repository files navigation

Aerial

About

Aerial is an sveltekit application that extracts dominant colors from images and documents (mainly docx and pdf format) and displays the summary on the client. The core functionality relies heavily on kmeans_colors, a k-means clustering library written in Rust.

How Aerial works

The sole purpose of Aerial is to extract colors from valid file targets and ephemerally store those data after some time (like a week or so). There are API endpoints that are exposed that can be used to send file data or to retrieve information on extracted data. Upon receiving valid file target, aerial hands it off to Quirrel (a redis based queue process) before doing extraction. Once color data is extracted, the data will be available on API endpoint using their assigned unique ID.

Supported files

Aerial can extract colors in most image formats:

  • JPEG
  • PNG
  • GIF
  • SVG (only when no embedded fonts)
  • TIFF (rendering is experimental but colors can be extracted)
  • WebP

It can process the following document formats:

  • DOCX
  • PDF

Pre-requisites

The following applications must be installed in order for Aerial to run without issues:

  • Node.js version 18+ (Aerial's core functionality requires it to run sveltekit with a backend server)
  • Libreoffice tested using version 7.3.7.2 30(Build:2) with ubuntu (required for processing docx files)

Note: Aerial uses kmeans_colors compiled rust binary so we don't need to install the Rust compiler, Aerial should work on development or production server without rust installed. Proven to work on a fresh installation of windows os without rust on a computers. Source: /r/rust Reddit thread

Getting Started

API

Database

The command samples uses npx command but we can also use pnpm equivalent which is pnpx.

We are using Prisma as database ORM. To see prisma cli commands run:

npx prisma

To generate artifacts the first time or update Prisma Client run:

npx prisma generate

To run migrations from your Prisma schema and apply them to the database do:

npx prisma migrate dev --name init
# Do not forget to generate prisma client afterwards
npx prisma generate

Reset prisma migration, useful for when changing schema and re-running seeders:

npx prisma migrate reset
npx prisma migrate dev --name init

Prisma has their own database viewer called prisma studio that runs on the browser:

npx prisma studio

About

Proof of concept of getting dominant colors in images and each page of a docx or pdf file using kmeans_colors and mupdf. Rendered using sveltekit framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published