From 210c7b4bdc52c2c1deba2ce23c827105f4154322 Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Sat, 11 Apr 2015 03:01:22 +0200 Subject: [PATCH] refactor: remove colorspace feature --- README.md | 2 +- options.go | 1 - resize_test.go | 19 ------------------- vips.go | 28 ---------------------------- vips.h | 19 ------------------- 5 files changed, 1 insertion(+), 68 deletions(-) diff --git a/README.md b/README.md index e89e610..47f00cf 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ For getting started, take a look to the [examples](#examples) and [programmatic bimg was heavily inspired in [sharp](https://github.com/lovell/sharp), its homologous package built for node.js by [Lovell Fuller](https://github.com/lovell). -**Note**: bimg is still beta. Pull request and issues are highly appreciated +**Note**: bimg is still beta. Do not use in production yet ## Prerequisites diff --git a/options.go b/options.go index 598faf0..7b2c2fb 100644 --- a/options.go +++ b/options.go @@ -88,7 +88,6 @@ type Options struct { Flip bool Flop bool NoAutoRotate bool - Colorspace bool Rotate Angle Gravity Gravity Watermark Watermark diff --git a/resize_test.go b/resize_test.go index 0c29dd6..fba2485 100644 --- a/resize_test.go +++ b/resize_test.go @@ -45,25 +45,6 @@ func TestRotate(t *testing.T) { } } -func testColorspace(t *testing.T) { - options := Options{Colorspace: true} - buf, _ := Read("fixtures/sky.jpg") - - newImg, err := Resize(buf, options) - if err != nil { - t.Errorf("Resize(imgData, %#v) error: %#v", options, err) - } - - if DetermineImageType(newImg) != JPEG { - t.Fatal("Image is not jpeg") - } - - err = Write("fixtures/test_color_out.jpg", newImg) - if err != nil { - t.Fatal("Cannot save the image") - } -} - func TestCorruptedImage(t *testing.T) { options := Options{Width: 800, Height: 600} buf, _ := Read("fixtures/corrupt.jpg") diff --git a/vips.go b/vips.go index 27ff941..5d7a966 100644 --- a/vips.go +++ b/vips.go @@ -156,34 +156,6 @@ func vipsZoom(image *C.struct__VipsImage, zoom int) (*C.struct__VipsImage, error return out, nil } -func vipsColorSpace(image *C.struct__VipsImage) (*C.struct__VipsImage, error) { - var out *C.struct__VipsImage - var temp *C.struct__VipsImage - var max *C.double - var x *C.int - var y *C.int - - defer C.g_object_unref(C.gpointer(image)) - - err := C.vips_colorspace_bridge(image, &out) - if err != 0 { - return nil, catchVipsError() - } - - err = C.vips_hist_find_ndim_bridge(out, &temp) - if err != 0 { - return nil, catchVipsError() - } - - err = C.vips_max_bridge(temp, max, &x, &y) - if err != 0 { - return nil, catchVipsError() - } - debug("MAX VALUE %dx%d", x, y) - - return temp, nil -} - func vipsWatermark(image *C.struct__VipsImage, w Watermark) (*C.struct__VipsImage, error) { var out *C.struct__VipsImage diff --git a/vips.h b/vips.h index bdec6b9..a896310 100644 --- a/vips.h +++ b/vips.h @@ -111,25 +111,6 @@ vips_zoom_bridge(VipsImage *in, VipsImage **out, int xfac, int yfac) return vips_zoom(in, out, xfac, yfac, NULL); }; -int -vips_colorspace_bridge(VipsImage *in, VipsImage **out) -{ - return vips_colourspace(in, out, VIPS_INTERPRETATION_LAB, NULL); -}; - -int -vips_hist_find_ndim_bridge(VipsImage *in, VipsImage **out) -{ - return vips_hist_find_ndim(in, out, "bins", 5, NULL); -}; - -int -vips_max_bridge(VipsImage *in, double *out, int **x, int **y) -{ - double ones[3] = { 1, 1, 1 }; - return vips_max(in, ones, "x", x, "y", y, NULL); -}; - int vips_embed_bridge(VipsImage *in, VipsImage **out, int left, int top, int width, int height, int extend) {