mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-11 00:10:27 -07:00
refactor: remove colorspace feature
This commit is contained in:
parent
8abe7b850c
commit
210c7b4bdc
5 changed files with 1 additions and 68 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ type Options struct {
|
|||
Flip bool
|
||||
Flop bool
|
||||
NoAutoRotate bool
|
||||
Colorspace bool
|
||||
Rotate Angle
|
||||
Gravity Gravity
|
||||
Watermark Watermark
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
28
vips.go
28
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
|
||||
|
||||
|
|
|
|||
19
vips.h
19
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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue