mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-15 18:35:54 -07:00
refactor
This commit is contained in:
commit
885b315035
4 changed files with 37 additions and 19 deletions
|
|
@ -2,6 +2,7 @@ language: go
|
||||||
go:
|
go:
|
||||||
- 1.4
|
- 1.4
|
||||||
- 1.3
|
- 1.3
|
||||||
- 1.2
|
|
||||||
- release
|
- release
|
||||||
- tip
|
- tip
|
||||||
|
before_install:
|
||||||
|
- curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | sudo bash -
|
||||||
|
|
|
||||||
34
README.md
34
README.md
|
|
@ -1,9 +1,39 @@
|
||||||
# bimg
|
# bimg [](https://travis-ci.org/h2non/bimg) []() [](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`
|
`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
|
## License
|
||||||
|
|
||||||
MIT - Tomas Aparicio
|
MIT - Tomas Aparicio
|
||||||
|
|
|
||||||
2
vips.go
2
vips.go
|
|
@ -13,6 +13,8 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type vipsImage *C.struct__VipsImage
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
defer runtime.UnlockOSThread()
|
defer runtime.UnlockOSThread()
|
||||||
|
|
|
||||||
15
vips.h
15
vips.h
|
|
@ -11,27 +11,12 @@ enum types {
|
||||||
MAGICK
|
MAGICK
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
#define JPEG 0
|
|
||||||
#define WEBP "WEBP"
|
|
||||||
#define PNG "PNG"
|
|
||||||
#define TIFF "TIFF"
|
|
||||||
#define MAGICK "MAGICK"
|
|
||||||
#define UNKNOWN "UNKNOWN"
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
int
|
||||||
vips_affine_interpolator(VipsImage *in, VipsImage **out, double a, double b, double c, double d, VipsInterpolate *interpolator)
|
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);
|
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*
|
VipsImage*
|
||||||
vips_image_buffer_seq(void *buf, size_t len)
|
vips_image_buffer_seq(void *buf, size_t len)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue