Skip to content
bindings to gd library
Go
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
testdata
README.md
bounds.go
bounds_test.go
example_test.go
gd.go
gd_image.go
gif.go
image.go
image_test.go
jpeg.go
png.go
registry.go
util.go

README.md

package mogrify

Package mogrify binds to libgd to perform transformations on images. It supports GIF/JPEG/PNG images, which it can decode and encode to. You can decode from a format and encode to another.

The current set of transformations is limited to cropping, resizing and resampling.

Install

You will need libgd for the C bindings, then:

go get github.com/tobi/mogrify-go

Docs?

Godocs!

Usage

jpg, err := mogrify.DecodeJpeg(file)
if err != nil { log.Fatalf(err) }
defer jpg.Destroy()

b := mogrify.Bounds{Width: 50, Height: 50}

resized, err := jpg.NewResized(b)
if err != nil { log.Fatalf(err) }
defer resized.Destroy()

_, _ := mogrify.EncodeGif(newfile, resized)
if err != nil { log.Fatalf(err) }
Something went wrong with that request. Please try again.