Edgar Image is a image transformer that runs in a docker image which you can host where you want and put behind Cloudflare to cache the response.

  • By null
  • Last update: Nov 2, 2022
  • Comments: 6

Edgar Image

Edgar Image is an open-source image transformation service built to make it possible for developers to own and host their own image services. Including functionality such as changing the width, height, and quality of a remote image but also encoding it into more modern formats.

The goal is for you as a developer to just deploy the service onto a hosting provider you choose your own, that's why we only provide a docker container.

Documentation

You find the documentation at https://edgar-image.com

Features

Functionality Required Query parameter Input
Source x src Url to the image
Width w Number. ex 700
Height h Number. ex 700
Blur blur Number. Max 100.
Sharpen sharpen Number. Max 100.
Format format String. One of: webp, jpeg, png.
Fit fit String. One of: fit, fill, auto. Default: auto .
Anchor anchor String. One of: top-left,top,top-right, left, center, right, bottom-left, bottom, bottom-right. Default: center .
Resample Filter resample-filter String. One of: lanczos, catmul-rom, mitchell-netravali, linear, box, nearest-neighbor, Default: lanczos

We would love feedback on more functionality to add. If you have an idea are you more then welcome to contribute or by commenting the functionality you are looking for here: #15

Usage/Examples

Use the service while it's deployed

All settings are sent as query parameters. To generate a image with width of 400px, height of 400px, quality of 100% from the original image and sharpen the image with 30 sigma do you add these query parameters.

https://image.edgar-image.com/?src=https://images.unsplash.com/photo-1659419865658-54b9eff7fbc0&w=400&h=400&q=100&sharpen=30

To start the docker container

To start the Docker container do you only need to run

docker run -p 8080:8080 emilpriver/edgar-image:VERSION

To start the Docker container with a config file:

Default config file:

{
	  "domains": ["*"],
    "allowedImageOutputFormats": ["image/webp", "image/jpeg", "image/png"],
    "defaults": {
        "quality": 70 
    }
}

OBS we expect that the config file include all of the fields abow. Domains can include wildcards, example: *.example.com. Supported formats are: - imge/webp - image/jpeg - image/png

Example of a modified config file:

{
	  "domains": ["image.unsplash.com", "*.edgar-image.com"],
    "allowedImageOutputFormats": ["image/jpeg", "image/png"],
    "defaults": {
        "quality": 60
    }
}

After you have modified the config file can you start the container with:

docker run -p 8080:8080 -v $(pwd)/config.json:/app/config.json emilpriver/edgar-image:VERSION

Caching

As this service only provide the functionality to transform a image and encode it into more mordern formats, you will need to manage caching on your own. However, there are relatively simple ways to solve it. For example, can run the entire system behind cloudflare and cache the content with Cloudflare.

In the future, there will be a solution to cache images on the server.

Documentation

We are currently working on documentation.

We will cover how to cache your images on for example Cloudflare and how to host the system on different providers such as Digitalocean and AWS

More Information

This system is in beta meaning there can be errors. We would love inputs and feedback.

This README is a work in progress

Our goal is also to in the documentation provide information about how you can deploy this system to different providers. Also to provide information on automatic deployments when we release updates

Download

edgar-image.zip

Comments(6)

  • 1

    More image transformation options

    We need more image transformation options:

    • [ ] Background, able to set a background out of a hex or RGB
    • [x] Blur
    • [ ] Crop
      • [ ] Focal points. To use when croping the image
    • [ ] Fit
    • [ ] Flip
    • [x] Width
    • [x] Height
    • [ ] Resize type. NearestNeighbor, Linear, CatmulRom, Lanczos and so on. Docs: https://pkg.go.dev/github.com/disintegration/imaging#readme-image-resizing
    • [x] Quality
    • [x] Sharpen
  • 2

    Documentation

    We need to add docs and a README.md file. Docs should include:

    • How it works
    • How to use it
    • Setup
    • Background information
    • Handle cacheing
    • Deploy to different providers
  • 3

    More functionality

    We need more image transformation options:

    • [x] Background, able to set a background out of a hex or RGB
    • [x] Blur
    • [x] Crop
      • [x] Focal points. To use when croping the image
    • [x] Fit
    • [x] Flip
    • [x] Width
    • [x] Height
    • [x] Resize type. NearestNeighbor, Linear, CatmulRom, Lanczos and so on. Docs: https://pkg.go.dev/github.com/disintegration/imaging#readme-image-resizing
    • [x] Quality
    • [x] Sharpen
    • [x] Format. Force a format
  • 4

    Bump guyarb/golang-test-annotations from 0.5.1 to 0.6.0

    Bumps guyarb/golang-test-annotations from 0.5.1 to 0.6.0.

    Release notes

    Sourced from guyarb/golang-test-annotations's releases.

    Fixes

    What's Changed

    Full Changelog: https://github.com/guyarb/golang-test-annotations/compare/v0.5.1...v0.6.0

    Commits

    Dependabot compatibility score

    You can trigger a rebase of this PR by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • 5

    Admin Dashboard

    We need a dashboard to let users add domains and for future used.

    Goal is to be able to sign in and add allowed domains. Would be good to be allowed to upload a file of domains.

    In the future should the user be able to create presets

  • 6

    AVIF: Encodeing sometimes fail causing image to no be displayed

    Request sometimes fails. Ex: https://image.priver.dev/?src=https://images.unsplash.com/photo-1659350413435-10d904595328&blur=20&w=200&h=500.

    This happens locally aswell