Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

bindings to gd library

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 testdata
Octocat-spinner-32 README.md
Octocat-spinner-32 bounds.go
Octocat-spinner-32 bounds_test.go
Octocat-spinner-32 example_test.go
Octocat-spinner-32 gd.go
Octocat-spinner-32 gd_image.go
Octocat-spinner-32 gif.go
Octocat-spinner-32 image.go
Octocat-spinner-32 image_test.go
Octocat-spinner-32 jpeg.go
Octocat-spinner-32 png.go
Octocat-spinner-32 registry.go
Octocat-spinner-32 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.