🎨 IMGART it's a simple, fast and reliable HTTP service for image processing based on filters and profiles
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vscode
assets
cache
cmd/imgartapi
config
effect
errors
httpapi
image
imgart
log
mock
profile
repository
.gitignore
.travis.yml
Dockerfile
Dockerfile.CI
LICENSE
Makefile
Procfile
README.md
_config.yml
docker-compose.debug.yml
docker-compose.yml
go.mod
go.sum
redis.conf

README.md

IMGART Build Status Go Report Card

logo

IMGART it's an HTTP service for image processing based on filters and profiles.

Documentation: https://imgart.herokuapp.com/api/v1/docs

Features

  • Image manipulation
  • Image caching (Redis)
  • Predefined Profiles (MongoDB)
  • API Documentation (Swagger Specification)
  • Error Handling
  • Docker
  • Debugging using Delve and Docker
  • Makefile
  • Testing
  • Graceful shutdown
  • Healthcheck

Docker Support

  • Dockerfile (Development)
  • Dockerfile.CI (Production)
  • docker-compose.yml (Run application)
  • docker-compose.debug.yml (Run application with delve for debugging)

Setup Project

  • Clone repository: git clone git@github.com:Talento90/imgart.git
  • Install dependencies: make deps
  • Run using docker: docker-compose up or make docker
  • Open application: open http:localhost:4005

Usage

{host}/api/v1/images?imgSrc={0}&profile={1}&filters={2}

  • host: Server address
  • imgSrc: Image URL
  • profile: Profile we want to apply
  • filters: List of filters to process

Example

https://imgart.herokuapp.com/api/v1/images?imgSrc=https://goo.gl/mq7yPD&profile=example&filters=[{"id":"rotate","parameters":{"angle":-90}}]

Result

result

Effects

The engine behind image manipulation is the fabulous library: github.com/disintegration/

Available Effects

Effect JSON Result
overlay {"id":"overlay","parameters":{"position":[25,75],"url":"https://goo.gl/UBrXeo","opacity":100}} overlay
resize {"id":"resize","parameters":{"width":25,"height":50,"filter":"linear"}} resize
crop {"id":"crop","parameters":{"rectangle":[0,0,202,150]}} crop
rotate {"id":"rotate","parameters":{"angle":-90,"bgcolor":"transparent"}} rotate
blur {"id":"blur","parameters":{"sigma":0.9} blur
brightness {"id":"brightness","parameters":{"percentage":-50}} brightness
contrast {"id":"contrast","parameters":{"percentage":100}} contrast
gamma {"id":"gamma","parameters":{"gamma":0.2}} gamma

It's possible to combine multiple effects:

/api/v1/images?imgSrc=https://raw.githubusercontent.com/Talento90/imgart/master/assets/gopher.png&filters=[{"id":"overlay","parameters":{"position":[25,75],"url":"https://goo.gl/UBrXeo"}},{"id":"overlay","parameters":{"position":[22,-35],"url":"https://goo.gl/aEkkDh"}}, {"id":"crop","parameters":{"rectangle":[0,0,202,150]}}]

result

Profiles

If you don't want to specify filters in URL, you can create a profile with all pre configured filters and then use it in query parameters &profile={profile-id}.

Create Profile

POST /api/v1/profiles

{
    "id": "my-profile",
    "filters": [
        { "id": "brightness", "parameters":{ "percentage":0.3}},
        { "id": "crop", "parameters":{"rectangle":[0,0,100,200]}}
    ]
}

Using profile in query parameters

GET /api/v1/images?imgSrc={image url}&profile=my-profile