Convert Figma logo to code with AI

cshum logoimagor

Fast, secure image processing server and Go library, using libvips

3,941
168
3,941
3

Top Related Projects

10,465

thumbor is an open-source photo thumbnail service by globo.com

Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing

A caching, resizing image proxy written in Go

2,329

An image resizing server written in Go

1,200

Dockerized application that resizes and crops images on the fly, delivering optimized images in formats such as AVIF, WebP, MozJPEG, or PNG using ImageMagick, with an efficient caching system.

10,529

Fast and secure standalone server for resizing, processing, and converting images on the fly

Quick Overview

Imagor is a fast, Docker-ready image processing server written in Go. It's designed to be a high-performance, on-demand image manipulation and optimization service, capable of handling a wide range of image operations including resizing, cropping, and various filters.

Pros

  • High performance and scalability due to its Go implementation
  • Extensive image manipulation capabilities (resize, crop, filters, etc.)
  • Easy deployment with Docker support
  • Compatible with Thumbor's URL structure, making it a drop-in replacement

Cons

  • Limited documentation compared to some more established alternatives
  • Fewer built-in storage options compared to Thumbor
  • May require additional setup for advanced features or custom integrations
  • Relatively newer project, which might mean less community support

Code Examples

  1. Basic image resizing:
import "github.com/cshum/imagor"

loader := imagor.NewHTTPLoader()
processor := imagor.NewProcessor()

result, err := processor.Process(ctx, loader, imagor.Params{
    Image: "https://example.com/image.jpg",
    Width: 300,
    Height: 200,
})
  1. Applying filters:
result, err := processor.Process(ctx, loader, imagor.Params{
    Image: "https://example.com/image.jpg",
    Filters: []imagor.Filter{
        {Name: "brightness", Args: []interface{}{10}},
        {Name: "contrast", Args: []interface{}{15}},
    },
})
  1. Cropping and resizing:
result, err := processor.Process(ctx, loader, imagor.Params{
    Image:  "https://example.com/image.jpg",
    Width:  300,
    Height: 200,
    CropMode: imagor.CropModeSmartCrop,
    Fit:      imagor.FitCover,
})

Getting Started

To get started with Imagor, follow these steps:

  1. Install Imagor:

    go get github.com/cshum/imagor
    
  2. Create a basic server:

    package main
    
    import (
        "github.com/cshum/imagor"
        "github.com/cshum/imagor/imagorpath"
    )
    
    func main() {
        app := imagor.New(
            imagor.WithLoaders(imagor.NewHTTPLoader()),
            imagor.WithProcessors(imagor.NewProcessor()),
        )
        server := imagorpath.NewServer(app)
        server.ListenAndServe(":8000")
    }
    
  3. Run the server and access images using Thumbor-compatible URLs:

    http://localhost:8000/300x200/filters:brightness(10):contrast(15)/https://example.com/image.jpg
    

Competitor Comparisons

10,465

thumbor is an open-source photo thumbnail service by globo.com

Pros of Thumbor

  • More mature and widely adopted project with a larger community
  • Extensive documentation and broader feature set
  • Supports multiple storage backends and caching mechanisms

Cons of Thumbor

  • Written in Python, which may have performance limitations compared to Go
  • Can be more complex to set up and configure
  • Larger resource footprint

Code Comparison

Thumbor (Python):

from thumbor.handlers.imaging import ImagingHandler

class MyHandler(ImagingHandler):
    def get(self):
        # Custom image processing logic
        super(MyHandler, self).get()

Imagor (Go):

package main

import "github.com/cshum/imagor"

func main() {
    srv := imagor.New()
    srv.Use(imagor.NewProcessor())
    srv.ListenAndServe(":8000")
}

Key Differences

  • Thumbor offers more built-in features and flexibility, while Imagor focuses on simplicity and performance
  • Imagor is written in Go, which can provide better performance and lower resource usage
  • Thumbor has a more extensive plugin ecosystem, whereas Imagor has a more streamlined approach
  • Imagor's API is designed to be compatible with Thumbor, making migration easier

Both projects aim to provide efficient image processing and serving capabilities, with Thumbor offering more features and Imagor prioritizing performance and simplicity.

Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing

Pros of Imaginary

  • Written in Go, potentially offering better performance and concurrency
  • Supports a wider range of image processing operations, including face detection and smart cropping
  • Provides a Docker image for easy deployment

Cons of Imaginary

  • More complex setup and configuration compared to Imagor
  • Larger codebase, which may lead to a steeper learning curve
  • Fewer built-in caching options

Code Comparison

Imaginary (main.go):

func main() {
    opts := ServerOptions{
        Port:               9000,
        CORS:               false,
        EnableURLSource:    true,
        EnablePlaceholder:  true,
        EnableURLSignature: true,
    }
    server := NewServer(opts)
    server.Listen()
}

Imagor (main.go):

func main() {
    app := imagor.New()
    app.Use(imagor.LoaderURL())
    app.Use(imagor.ProcessorImage())
    app.Use(imagor.ServerImage())
    app.Run(":8000")
}

Both projects offer powerful image processing capabilities, but Imaginary provides more advanced features at the cost of increased complexity. Imagor focuses on simplicity and ease of use, making it a good choice for projects with straightforward image processing needs. The code comparison shows that Imaginary requires more configuration options, while Imagor has a more streamlined setup process.

A caching, resizing image proxy written in Go

Pros of imageproxy

  • Written in Go, potentially offering better performance and concurrency
  • Supports a wider range of image processing operations, including rotation and smart cropping
  • More flexible caching options, including support for various backends like Amazon S3 and Google Cloud Storage

Cons of imageproxy

  • Less actively maintained, with fewer recent updates compared to imagor
  • Lacks some advanced features present in imagor, such as lazy loading and watermarking
  • May have a steeper learning curve for configuration and deployment

Code Comparison

imageproxy:

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    if r.URL.Path == "/favicon.ico" {
        http.Error(w, "404 Not Found", http.StatusNotFound)
        return
    }
    // ... (additional code)
}

imagor:

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    ctx := r.Context()
    start := time.Now()
    defer func() {
        s.metrics.Latency.Observe(time.Since(start).Seconds())
    }()
    // ... (additional code)
}

Both projects implement image processing servers, but they differ in their approach and feature sets. imageproxy offers a broader range of image operations and flexible caching, while imagor provides more advanced features and active development. The choice between them depends on specific project requirements and preferences.

2,329

An image resizing server written in Go

Pros of picfit

  • Written in Go, potentially offering better performance and concurrency
  • Supports multiple storage backends (File System, Amazon S3, Google Cloud Storage)
  • Includes a built-in HTTP server for serving processed images

Cons of picfit

  • Less actively maintained (last commit over 2 years ago)
  • Fewer image processing operations compared to imagor
  • Limited documentation and examples

Code Comparison

imagor (Python):

from imagor import imagor

app = imagor()
app.run(host='0.0.0.0', port=8000)

picfit (Go):

package main

import "github.com/thoas/picfit"

func main() {
    picfit.Run()
}

Both projects aim to provide image processing and serving capabilities, but they differ in implementation language and feature sets. imagor is written in Python and offers a wider range of image processing operations, while picfit is implemented in Go and focuses on performance and multiple storage backend support.

imagor has more recent development activity and better documentation, making it potentially easier to adopt and integrate. However, picfit's Go implementation may provide better performance for high-load scenarios.

The code comparison shows that both projects offer simple ways to start the image processing server, with imagor providing more configuration options directly in the startup code.

1,200

Dockerized application that resizes and crops images on the fly, delivering optimized images in formats such as AVIF, WebP, MozJPEG, or PNG using ImageMagick, with an efficient caching system.

Pros of flyimg

  • Built with PHP and Symfony, which may be more familiar to some developers
  • Supports a wider range of image processing operations out-of-the-box
  • Includes a built-in security layer with signing requests

Cons of flyimg

  • Less actively maintained compared to imagor
  • May have higher resource requirements due to PHP runtime
  • Fewer deployment options and less cloud-native focus

Code Comparison

imagor:

func (p *ImageProcessor) Resize(img image.Image, width, height int) image.Image {
    return resize.Resize(uint(width), uint(height), img, resize.Lanczos3)
}

flyimg:

public function resize(Image $image, int $width, int $height): Image
{
    return $image->resize($width, $height);
}

Both projects offer similar core functionality for image processing, but their implementations differ based on the programming languages used. imagor is written in Go, which may provide better performance and lower resource usage, while flyimg uses PHP, which might be more accessible to web developers familiar with the LAMP stack.

imagor focuses on being a lightweight, cloud-native solution with easy deployment options, while flyimg offers a more comprehensive set of image manipulation features out-of-the-box. The choice between the two may depend on specific project requirements, team expertise, and infrastructure preferences.

10,529

Fast and secure standalone server for resizing, processing, and converting images on the fly

Pros of imgproxy

  • Written in Go, offering potentially better performance and lower resource usage
  • Supports a wider range of image processing operations, including face detection and watermarking
  • More actively maintained with frequent updates and releases

Cons of imgproxy

  • More complex setup and configuration compared to imagor
  • Requires separate installation of libvips and other dependencies
  • May have a steeper learning curve for newcomers to image processing

Code Comparison

imagor configuration example:

ALLOWED_SOURCES = ['http://example.com/']
MAX_WIDTH = 1000
MAX_HEIGHT = 1000

imgproxy configuration example:

IMGPROXY_KEY=your_key
IMGPROXY_SALT=your_salt
IMGPROXY_MAX_SRC_RESOLUTION=50

Key Differences

  • imagor is Python-based, while imgproxy is Go-based
  • imagor follows the Thumbor API, making it easier to migrate from Thumbor
  • imgproxy offers more advanced features like automatic format conversion and WebP support
  • imagor has a simpler setup process, especially for Python developers
  • imgproxy may have better performance for high-volume image processing tasks

Both projects aim to provide efficient image processing and serving capabilities, but they cater to different use cases and developer preferences. The choice between them depends on specific project requirements, existing infrastructure, and team expertise.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

imagor

Test Status Codecov Docker Hub Docs

imagor is a fast, secure image processing server and Go library.

imagor uses one of the most efficient image processing library libvips with Go binding vipsgen. It is typically 4-8x faster than using the quickest ImageMagick settings. imagor implements libvips streaming that facilitates parallel processing pipelines, achieving high network throughput.

imagor features a ton of image processing use cases, available as a HTTP server with first-class Docker support. It adopts the thumbor URL syntax representing a high-performance drop-in replacement.

imagor is a Go library built with speed, security and extensibility in mind. Alongside there is imagorvideo bringing video thumbnail capability through ffmpeg C bindings.

Quick Start

docker run -p 8000:8000 shumc/imagor -imagor-unsafe -imagor-auto-webp

Original images:

https://raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png
https://raw.githubusercontent.com/cshum/imagor/master/testdata/dancing-banana.gif
https://raw.githubusercontent.com/cshum/imagor/master/testdata/gopher-front.png

Try out the following image URLs:

http://localhost:8000/unsafe/fit-in/200x200/filters:fill(white)/https://raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png
http://localhost:8000/unsafe/200x200/smart/filters:fill(white):format(jpeg):quality(80)/https://raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png
http://localhost:8000/unsafe/fit-in/-180x180/10x10/filters:hue(290):saturation(100):fill(yellow)/raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png
http://localhost:8000/unsafe/30x40:100x150/filters:fill(cyan)/raw.githubusercontent.com/cshum/imagor/master/testdata/dancing-banana.gif
http://localhost:8000/unsafe/fit-in/200x150/filters:fill(yellow):watermark(raw.githubusercontent.com/cshum/imagor/master/testdata/gopher-front.png,repeat,bottom,0,40,40)/raw.githubusercontent.com/cshum/imagor/master/testdata/dancing-banana.gif

[!NOTE] Full documentation is available at docs.imagor.net.