Skip to content

bemyak/squarifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Squarifier

This is a tiny project that help me run my D&D and Pathfinder games at Roll20.

Where?

You can try it at https://squarifier.ml

What?

In short, it dynamically turns this:

Qurashith

into this:

Squarified Qurashith

The image got cropped and made into a square.

Why?

There are few problems with Roll20 that I was constantly facing:

  1. Too small storage (100 Mb for images)
  2. When you insert non-rectangular token, it gets stretched in order to fill the square

I found the solution for the first problem, which is described at the end of my blog post Rolling like a Pro. In short, I'm now able to insert images as links, which doesn't eat any space at all.

But now the second problem got much more worse: you rarely can find a square image on the internet, so you need to download it, crop, make square and this nullifies any win from the #1, because you don't have an image URL now, and you need to upload it again.

To solve this, this project was created. It acts like a proxy that changes your images in the way you'd probably want it: cropped and square. 🎉

How?

We need to process images really quickly in order to be able to respond as fast as possible. We still need to:

  1. Get the request
  2. Download requested image, while the incoming request is waiting
  3. Process it
  4. Answer the request with a processed image

So, the overall latency is around 2 * original_request_latency

To minimize it further you can run Squarifier locally or on some nearby server that has public IP and/or DNS name. To see how the infrastructure is set up, check my infrastructure repository.

About

Make any image square as a service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published