A selection of image manipulation tools

Related tags

Images tools img
Overview

img docs

A collection of image manipulation tools. Each tool takes an input file from standard input, this needs to be in PNG, JPEG or GIF format. They output the resulting image (by default in PNG format) to standard output.

To install run,

$ go install hawx.me/code/img

You can then run go help and go help [command] for information.

The aim of img is not to be fast, if you want fast use GraphicsMagick, the aim is to be readable. Diving through endless files of C and C++ to find out how a certain effect is implemented is no fun, reading a single Go file is hopefully better.

Example (Command Line)

Here is an example: First we convert the image to greyscale using the values from the red colour channel, then boost the contrast slightly using a linear function, and finally tint the image with a dark red.

(img greyscale --red | \
  img contrast --linear --ratio 1.5 | \
  img tint --with '#83121344') < input.png > output.png

You can see here how easy it is to chain different tools together using pipes.

Example (Go)

You can also use the img libraries in Go code. We could rewrite the previous example as,

// example.go
package main

import (
  "hawx.me/code/img/contrast"
  "hawx.me/code/img/greyscale"
  "hawx.me/code/img/tint"

  "image/png"
  "os"
)

func main() {
  input, _ := os.Open(os.Args[1])
  img,   _ := png.Decode(input)

  img = greyscale.Red(img)
  img = contrast.Linear(img, 1.5)
  img = tint.Tint(img, color.NRGBA{131, 18, 19, 255})

  output, _ := os.Create(os.Args[2])
  png.Encode(output, img)
}

This can then be compiled and run like ./example input.png output.png.

You might also like...
Imaging is a simple image processing package for Go
Imaging is a simple image processing package for Go

Imaging Package imaging provides basic image processing functions (resize, rotate, crop, brightness/contrast adjustments, etc.). All the image process

Pure golang image resizing
Pure golang image resizing

This package is no longer being updated! Please look for alternatives if that bothers you. Resize Image resizing for the Go programming language with

smartcrop finds good image crops for arbitrary crop sizes
smartcrop finds good image crops for arbitrary crop sizes

smartcrop smartcrop finds good image crops for arbitrary sizes. It is a pure Go implementation, based on Jonas Wagner's smartcrop.js Image: https://ww

Go package for decoding and encoding TARGA image format

tga tga is a Go package for decoding and encoding TARGA image format. It supports RLE and raw TARGA images with 8/15/16/24/32 bits per pixel, monochro

:triangular_ruler: Create beautiful generative image patterns from a string in golang.
:triangular_ruler: Create beautiful generative image patterns from a string in golang.

geopattern Create beautiful generative image patterns from a string in golang. Go port of Jason Long's awesome GeoPattern library. Read geopattern's d

Go Image Filtering Toolkit
Go Image Filtering Toolkit

GO IMAGE FILTERING TOOLKIT (GIFT) Package gift provides a set of useful image processing filters. Pure Go. No external dependencies outside of the Go

Go Perceptual image hashing package

goimagehash Inspired by imagehash A image hashing library written in Go. ImageHash supports: Average hashing Difference hashing Perception hashing Wav

The imghdr module determines the type of image contained in a file for go
The imghdr module determines the type of image contained in a file for go

goimghdr Inspired by Python's imghdr Installation go get github.com/corona10/goimghdr List of return value Value Image format "rgb" SGI ImgLib Files

:foggy: Convert image to ASCII
:foggy: Convert image to ASCII

🌁 Image2ascii Image2ASCII is a library that converts images into ASCII images and provides command-line tools for easy use. Installation go get githu

Comments
  • h=0 does not mean black

    h=0 does not mean black

    The implementation of HSLA and HSVA have a small bug where the returned called is black if h == 0, independent of the remaining parameters.

    I fixed this, but I did not check for negative h, because I didn't know how you want to handle that :)

    opened by surma 1
Owner
Joshua Hawxwell
Joshua Hawxwell
darkroom - An image proxy with changeable storage backends and image processing engines with focus on speed and resiliency.

Darkroom - Yet Another Image Proxy Introduction Darkroom combines the storage backend and the image processor and acts as an Image Proxy on your image

Gojek 203 Dec 6, 2022
Easily customizable Social image (or Open graph image) generator

fancycard Easily customizable Social image (or Open graph image) generator Built with Go, Gin, GoQuery and Chromedp Build & Run Simply, Clone this rep

Youngbin Han 4 Jan 14, 2022
An API which allows you to upload an image and responds with the same image, stripped of EXIF data

strip-metadata This is an API which allows you to upload an image and responds with the same image, stripped of EXIF data. How to run You need to have

Cristina Simionescu 0 Nov 25, 2021
Imgpreview - Tiny image previews for HTML while the original image is loading

imgpreview This is a Go program that generates tiny blurry previews for images t

Dmitry Chestnykh 8 May 22, 2022
Image processing algorithms in pure Go

bild A collection of parallel image processing algorithms in pure Go. The aim of this project is simplicity in use and development over absolute high

Anthony N. Simon 3.7k Jan 6, 2023
Go package for fast high-level image processing powered by libvips C library

bimg Small Go package for fast high-level image processing using libvips via C bindings, providing a simple programmatic API. bimg was designed to be

Tom 2.1k Jan 2, 2023
Image processing library and rendering toolkit for Go.

blend Image processing library and rendering toolkit for Go. (WIP) Installation: This library is compatible with Go1. go get github.com/phrozen/blend

Guillermo Estrada 61 Nov 11, 2022
Decode embedded EXIF meta data from image files.

goexif Provides decoding of basic exif and tiff encoded data. Still in alpha - no guarantees. Suggestions and pull requests are welcome. Functionality

Robert Carlsen 545 Dec 17, 2022
A lightning fast image processing and resizing library for Go

govips A lightning fast image processing and resizing library for Go This package wraps the core functionality of libvips image processing library by

David Byttow 816 Jan 8, 2023
Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing

imaginary Fast HTTP microservice written in Go for high-level image processing backed by bimg and libvips. imaginary can be used as private or public

Tom 4.7k Jan 3, 2023