• Stars
    star
    149
  • Rank 239,963 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 12 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A selection of image manipulation tools

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.

More Repositories

1

sass.sugar

[DEAD] An Espresso sugar for SASS
Ruby
102
star
2

guard-sass

Guard::Sass automatically rebuilds sass files when modified (like sass --watch)
Ruby
88
star
3

guard-shell

Guard::Shell automatically runs shell commands when watched files are modified.
Ruby
75
star
4

tally-ho

A micropub speaking blog
Go
51
star
5

tl-feed

tinyletter ⇉ rss feed
Go
17
star
6

mpd-scrobbler

Scrobbler for mpd
Go
15
star
7

vodka

A functional, stack-based, concatenative programming language
Go
14
star
8

relme-auth

An implementation of http://microformats.org/wiki/RelMeAuth
Go
13
star
9

indieauth

Go
9
star
10

riviera

A river.js generator
Go
7
star
11

ggg

¬ GitHub
Go
6
star
12

trobble

scrobble catcher
Go
6
star
13

hadfield

Basic subcommands to complement the flag package.
Go
6
star
14

clive

The option parser.
Ruby
5
star
15

rivelin

A river.js reader
Go
5
star
16

tw-delete

Deletes all tweets sent after a duration
Go
5
star
17

aoide

Go
5
star
18

riviera-admin

Admin panel for riviera
Go
5
star
19

retro

A webapp for running (remote) retrospectives
Elm
4
star
20

arboretum

A garden-of-news(?) style feed aggregator
Go
4
star
21

papiermache

¬ Instapaper
Go
4
star
22

img-ext

Extensions to img
Go
4
star
23

phemera

a forgetful blog
Go
4
star
24

evmpd

media-key events -> mpd
C
4
star
25

mustache.sugar

[DEAD] An Espresso sugar for Mustache Templates
4
star
26

alexandria

A library for your ebooks
Go
4
star
27

mpd-sound-menu

Display/control mpd from Ubuntu's sound menubar item
Go
3
star
28

route

A request router
Go
3
star
29

send-to-s3

Tool to send files to S3
Go
3
star
30

img-filtr

Port (kinda) of straup/filtr to use img
Go
3
star
31

iirc

an irc server, if i recall correctly
Go
3
star
32

duvet

Cover your code.
JavaScript
3
star
33

circumambient

Simple web proxy that publishes details of requests to redis
Go
3
star
34

catcon

Ruby
3
star
35

serve

serve.Serve()
Go
3
star
36

quantise

Go
2
star
37

persona

Go
2
star
38

Hackbot-heroku

2
star
39

xednese

ruby client for the esendex api
Ruby
2
star
40

vanity

Server for golang vanity import paths
Go
2
star
41

mpd-slack-status

Update your slack status to the current song playing in mpd
Go
2
star
42

tdo

Todo, a simple ruby app to manage your todo list
Ruby
2
star
43

henshin

A static site generator.
Ruby
2
star
44

elm-mixpanel

JavaScript
2
star
45

kindle-clippings

Tools for working with the Kindle's "My Clippings.txt" file
Go
2
star
46

echo

Simple echoing webserver
Go
2
star
47

tw-linkfeed

Like, a feed of all the links in your twitter stream
Go
2
star
48

seq

Seq cycles over elements of an array.
Ruby
2
star
49

relme

Go
2
star
50

smtp

An smtp server (wip)
Go
2
star
51

tw-feed

Like, a feed of your twitter stream
Go
1
star
52

parsey

Parsey matches a string with a pattern to retrieve data from it.
Ruby
1
star
53

xesende

go client for the esendex api
Go
1
star
54

sauna

[DEAD] A forum written in Ruby, using Sinatra
JavaScript
1
star
55

lsd

Elm
1
star
56

mux

Request routers
Go
1
star
57

overcomplicated-elm

github.com/Overcomplicated/website ported to elm, kinda
Elm
1
star
58

socketandserve

Go
1
star
59

elm-bulma

Elm
1
star
60

serialisable

Simple xml to object deserialisation for Ruby
Ruby
1
star
61

shroud

[DEAD] A wrapper for the CloudApp REST API
Ruby
1
star
62

serveable

Minimal fuss rack server hooks.
Ruby
1
star
63

dockerfiles

Collection of my Dockerfiles
Shell
1
star
64

rgoybiv

Go
1
star
65

logely

Pretty logging to console
Ruby
1
star
66

chords

Go
1
star
67

gmd

Script to help making and releasing gems easier.
Ruby
1
star
68

uberich

Go
1
star
69

hall-of-mirrors

Not yet...
Ruby
1
star
70

dotfiles

~/.
Shell
1
star
71

numbersix

a triple store (sqlite + json for values)
Go
1
star
72

esendex-push

Playing with the Esendex Push Notification API
Ruby
1
star
73

publishable

Easy publishing of #each-able items over SFTP.
Ruby
1
star
74

photo

please excuse the very generic name; I have lost imagination
JavaScript
1
star
75

jenkimon

A build monitor for jenkins
JavaScript
1
star
76

attr_plus

attr_accessor for class level instance variables.
Ruby
1
star
77

ihkh

Single-user port of jstn/ihardlyknowher
Go
1
star
78

ast_ast

String -> Tokens -> (AST)
Ruby
1
star
79

words

A local webapp for writing everyday
JavaScript
1
star
80

i-am-my-last

Aggregate your last (tweet / blog post / photo / listen / ...) onto a single page.
JavaScript
1
star
81

process-slack-status

Update your slack status when different processes are running
Go
1
star