diff --git a/.travis.yml b/.travis.yml index 17d0135..aa82785 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: go go: - 1.4 - 1.3 - - 1.2 - release - - tip \ No newline at end of file + - tip +before_install: + - curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | sudo bash - diff --git a/README.md b/README.md index eefc223..99c444e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,39 @@ -# bimg +# bimg [![Build Status](https://travis-ci.org/h2non/bimg.png)](https://travis-ci.org/h2non/bimg) [![GitHub release](https://img.shields.io/github/tag/h2non/bimg.svg)]() [![GoDoc](https://godoc.org/github.com/h2non/bimg?status.png)](https://godoc.org/github.com/h2non/bimg) -Go library for blazing fast image processing based on [libvips](https://github.com/jcupitt/libvips) +Go library for blazing fast image processing based on [libvips](https://github.com/jcupitt/libvips) using C bindings `Work in progress` +## Installation + +```bash +go get gopkg.in/h2non/bimg.v0 +``` + +Requires Go 1.3+ + +## API + +```go +import ( + "fmt" + "os" + "gopkg.in/h2non/bimg" +) + +options := bimg.Options{ + Width: 800, + Height: 600, + Crop: true, + Quality: 95, +} + +newImage, err := bimg.Resize(image, options) +if err != nil { + fmt.Fprintln(os.Stderr, err) +} +``` + ## License MIT - Tomas Aparicio diff --git a/vips.go b/vips.go index dd49339..62fb727 100644 --- a/vips.go +++ b/vips.go @@ -13,6 +13,8 @@ import ( "unsafe" ) +type vipsImage *C.struct__VipsImage + func init() { runtime.LockOSThread() defer runtime.UnlockOSThread() diff --git a/vips.h b/vips.h index 0e38995..9cb6f2e 100644 --- a/vips.h +++ b/vips.h @@ -11,27 +11,12 @@ enum types { MAGICK }; -/* -#define JPEG 0 -#define WEBP "WEBP" -#define PNG "PNG" -#define TIFF "TIFF" -#define MAGICK "MAGICK" -#define UNKNOWN "UNKNOWN" -*/ - int vips_affine_interpolator(VipsImage *in, VipsImage **out, double a, double b, double c, double d, VipsInterpolate *interpolator) { return vips_affine(in, out, a, b, c, d, "interpolate", interpolator, NULL); }; -int -vips_jpegload_buffer_seq(void *buf, size_t len, VipsImage **out) -{ - return vips_jpegload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL); -}; - VipsImage* vips_image_buffer_seq(void *buf, size_t len) {