Giter Club home page Giter Club logo

govips's Introduction

Hello 👋

I'm an engineer by day, and an engineer by night. I manage teams and write code every day. #AlwaysBeCoding 🏴‍☠️

govips's People

Contributors

alon-ne avatar attilathefun avatar axkirillov avatar bozaro avatar cshum avatar davidbyttow avatar dependabot[bot] avatar golanpa avatar gordonwu avatar idanya avatar italypaleale avatar jhford avatar jishi92 avatar maxpower15 avatar n0vad3v avatar nafanya avatar oikyn avatar phanirithvij avatar qbarrand avatar rafaelsierra avatar rcilia avatar rcunning avatar robxyy avatar roffe avatar sandro avatar songjiayang avatar toaster avatar tonimelisma avatar vansante avatar zzjin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

govips's Issues

Passing additional parameters to PDF loader

I'm developing a tool that convert pages in a PDF file to JPEG images. I need a way to specify which page to load from the PDF using this library, but it seems it is not currently possible.

From the libvips documentation, there are some parameters that allow for you to select which page, number of pages, DPI, and scale when loading the PDF:
http://jcupitt.github.io/libvips/API/current/VipsForeignSave.html#vips-pdfload-buffer

Checking this repo code, apparently there is currently no way to use these parameters.

Is it possible to do that?

If not, would adding a new argument to the init_image containing all the possible optional parameters, and then passing it over to the vips_pdfload_buffer function be the right way to tackle this? We could allow using the additional parameters for all other image types as well.

Thanks

Loading images through *magick

First off, thanks for making these bindings.

I am trying to make use of the vips *magick wrapping functionality.
I have gone through your code and see references to loading images with this feature. But I cannot figure out how to make use of it.
NewImageFromBuffer() seem to be able to support it. But then ImageTypeMagick cannot be passed nor is it ever set programtically; https://github.com/davidbyttow/govips/blob/master/pkg/vips/bridge.go#L126

Is this intentionally disabled or could I help tweak the API so the caller can hint the ImageType.

Regards Erik

Memory Leak

I am having a memory leak with govips.
Any suggestions how to solve this?

after several images

Allocated Memory = 104 MiB	Total Allocated Memory = 144 MiB	System Memory = 134 MiB	Number of GC = 7
VIPS Allocated Memory = 114 MiB	VIPS Total Allocated Memory = 121 MiB	VIPS Memory Allocations = 2 
Allocated Memory = 104 MiB	Total Allocated Memory = 288 MiB	System Memory = 134 MiB	Number of GC = 15
VIPS Allocated Memory = 171 MiB	VIPS Total Allocated Memory = 178 MiB	VIPS Memory Allocations = 3 

Originally posted by @evanoberholster in #44 (comment)

Prefix releases with 'v'

If possible, it might be a good idea to prefix future releases with a v. Otherwise, go mod will record a "pseudo-version" (something like "github.com/davidbyttow/govips v0.0.0-20190304175058-d272f04c0fea") in the go.mod file, which might trip up some users. Details here.

font size doesn't work

package main

import (
	"fmt"

	"github.com/davidbyttow/govips/pkg/vips"
)

func main() {
	lp := vips.LabelParams{
		Text:      "ChuckadfNorris2315fdddddddd skdaldlafiijoealfaladafefefefhjkl;hjkaadfadfadfd",
		Font:      "sans 10",
                //Font:       "sans 100",
		Opacity:   1.0,
		Width:     vips.ScaleOf(0.9),
		Height:    vips.ScaleOf(1.0),
		Alignment: vips.AlignCenter,
		OffsetX:   vips.ScaleOf(0),
		OffsetY:   vips.ScaleOf(0),
		Color:     vips.Color{R: 255, G: 255, B: 255},
	}

	_, _, err := vips.NewTransform().
		Label(&lp).
		LoadFile("foo.jpg").
		OutputFile("vips_10.jpg").
		Apply()
	fmt.Println("error:", err)
}

@davidbyttow hi, I use vips label function, and try to change the font size(from "sans 10" to "sans 100"), but i dosen't work, is there any mistake in the code ?

Some Image Types Not Supported

Currently it does not support OpenSlide image formats (vms, kfb, vmu etc.). The vips command line tool supports those formats by default.

The DetermineImageType function doesn't recognize them. I tried to add the support in Go code, but later found out the native function C.vips_type_find() always returns 0 on those formats. Bypassing the image type check would later result in error at C.init_image().

I wonder if any extra config is needed to support those formats? Basically I need the dzsave() from VipsForeignSave module.

Custom backgroun extend doesn't work

I want to use a custom background with transformation. But when I use Embed(vips.ExtendBackground) - background is still black even if I set transform.BackgroundColor(vips.Color{R:255,G:255,B:255}) for option Embed(vips.ExtendWhite) everything works fine.

Build Failure under Go 1.8

Platform: Darwin 15.6.0
Go Version: 1.8
VIPS Version: vips-8.4.5-Wed Jan 4 05:36:05 PST 2017 (homebrew)

Not building with the following errors:

go get -u gopkg.in/davidbyttow/govips.v0
# gopkg.in/davidbyttow/govips.v0
../gopkg.in/davidbyttow/govips.v0/options.go:72: cannot use src.(*Image).image (type *C.struct__VipsImage) as type C.gpointer in argument to func literal
../gopkg.in/davidbyttow/govips.v0/options.go:82: cannot use src.(*Blob).cBlob (type *C.struct__VipsBlob) as type C.gconstpointer in argument to func literal
../gopkg.in/davidbyttow/govips.v0/options.go:92: cannot use src.(*Interpolator).interp (type *C.struct__VipsInterpolate) as type C.gpointer in argument to func literal

Resize inside

Hi,

First thanks for the job of maintaining govips.

I would like to know whether it's possible mimick the "resize inside" strategy of sharp (itself inspired of CSS object-fit).

VipsOperation: class "jpegload_buffer" not found

go run cmd/examples/resize/resize.go -in assets/fixtures/canyon.jpg -out cmd/examples/build/resize-canyon.jpg
2019/12/27 23:52:26 Vips started with concurrency=1 cache_max_files=100 cache_max_mem=104857600 cache_max=500
2019/12/27 23:52:26 Registered image type loader type=gif
2019/12/27 23:52:26 Registered image type loader type=jpeg
2019/12/27 23:52:26 Registered image type loader type=magick
2019/12/27 23:52:26 Registered image type loader type=pdf
2019/12/27 23:52:26 Registered image type loader type=png
2019/12/27 23:52:26 Registered image type loader type=svg
2019/12/27 23:52:26 Registered image type loader type=tiff
2019/12/27 23:52:26 Registered image type loader type=webp
2019/12/27 23:52:26 VipsOperation: class "jpegload_buffer" not found

Stack:
goroutine 1 [running]:
runtime/debug.Stack(0x7f5c2ba02680, 0xc0000ac040, 0x31)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
github.com/davidbyttow/govips/pkg/vips.handleVipsError(0x0, 0x0)
/home/tlab-n023/go/src/github.com/davidbyttow/govips/pkg/vips/bridge.go:474 +0x9e
github.com/davidbyttow/govips/pkg/vips.vipsLoadFromBuffer(0xc000146000, 0x703b3, 0x7fe00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/tlab-n023/go/src/github.com/davidbyttow/govips/pkg/vips/bridge.go:150 +0x1ae
github.com/davidbyttow/govips/pkg/vips.(*Transform).importImage(0xc0000b7ef8, 0x4f9928, 0xc0000b7ef8, 0x0, 0x4f9d58)
/home/tlab-n023/go/src/github.com/davidbyttow/govips/pkg/vips/transform.go:384 +0xe2
github.com/davidbyttow/govips/pkg/vips.(*Transform).Apply(0xc0000b7ef8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/tlab-n023/go/src/github.com/davidbyttow/govips/pkg/vips/transform.go:352 +0xa3
main.resize(0x7ffecae5b1c0, 0x1a, 0x7ffecae5b1e0, 0x24, 0x0, 0x0)
/home/tlab-n023/go/src/govips/cmd/examples/resize/resize.go:38 +0x1dd
main.main()
/home/tlab-n023/go/src/govips/cmd/examples/resize/resize.go:25 +0xd4

How to replace color from the image ?

Hi experts
I am developing an image's border customization app on vips. Earlier its on image-magic. All the operations are being mapped from Image-magic to vips.

But I am stuck at image replace operation. In Image-magic, I used to copy alpha channel to achieve the desired color. Is similar possible in govips? How I can use bandadd here in govips?

1
2
3
4

Unable to install latest version

Unable to setup latest version of library.

➜  /tmp go version
go version go1.13 darwin/amd64

➜  /tmp vips --version
vips-8.8.3-Mon Sep 16 15:23:46 UTC 2019

➜  /tmp gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ go get -u github.com/davidbyttow/govips/pkg/vips

go build github.com/davidbyttow/govips/pkg/vips: invalid flag in pkg-config --cflags: -Xpreprocessor

GLibObject errors

What could be causing these errors?

(vips:214): GLib-GObject-CRITICAL **: 13:06:55.562: g_value_transform: assertion 'G_IS_VALUE (src_value)' failed

(vips:214): GLib-GObject-WARNING **: 13:06:55.564: unable to set property 'page' of type 'gint' from value of type '(null)'

(vips:214): GLib-GObject-CRITICAL **: 13:06:55.565: g_value_transform: assertion 'G_IS_VALUE (src_value)' failed

(vips:214): GLib-GObject-WARNING **: 13:06:55.565: unable to set property 'dpi' of type 'gdouble' from value of type '(null)'

(vips:214): GLib-GObject-CRITICAL **: 13:06:55.566: g_value_transform: assertion 'G_IS_VALUE (src_value)' failed

(vips:214): GLib-GObject-WARNING **: 13:06:55.566: unable to set property 'page' of type 'gint' from value of type '(null)'

In my code I'm trying to do stuff like this:

pageOption := vips.InputInt("page", 0)

I don't understand why I'm getting such errors.

Suppress logging

Is there a way to suppress debug logging from the library, or control it somehow? It's quite annoying to see all the logs printed.

Go program Killed: 9

I have a problem with using this package. Examples not work.
Program killed after run:

andrii@Andrii resize (master) $ vips -v
vips-8.4.5-Wed Apr  5 23:52:58 EEST 2017
andrii@Andrii resize (master) $ go version
go version go1.8 darwin/amd64
andrii@Andrii resize (master) $ go run resize.go 
signal: killed
andrii@Andrii resize (master) $ go build resize.go 
andrii@Andrii resize (master) $ ./resize 
Killed: 9

fatal: repository 'https://github.com/tj/go-debug/' not found

go get -u -v github.com/davidbyttow/govips

github.com/davidbyttow/govips (download)
github.com/tj/go-debug (download)
# cd .; git clone https://github.com/tj/go-debug /Users/mishamx/.go/src/github.com/tj/go-debug
Cloning into '/Users/mishamx/.go/src/github.com/tj/go-debug'...
remote: Repository not found.
fatal: repository 'https://github.com/tj/go-debug/' not found
package github.com/tj/go-debug: exit status 128

Question about concurrent usage

Thanks for the amazing VIPS binding. This is something I've been looking for. I am trying to build this as a microservice and have a questions in terms of the lifecycle of VIPS. I see that in some of the example following statements are present:
vips.Startup(nil)
vips.Shutdown()

My question is that this must be done per http request or once during the server startup/shutdown?

Moreover I am wondering if you have some benchmark comparing this with "sharp" (https://github.com/lovell/sharp) or "bimg" (https://github.com/h2non/bimg). I understand it may not be a 1:1 comparison but it'd be nice to see some numbers.

thanks.

Optimizing PNG images

I have govips very succesfully aggresively optimizing images like this:

c, _, err := vips.NewTransform().
		LoadBuffer(b).
		Quality(15).
		StripMetadata().
		OutputBytes().
		Apply()

This reduces file size (at some cost to quality of course) for gif, jpg and svg images - but it is not having any impact on my sample PNG files (same with a tiff but I have not experimented much beyond one sample tiff).

Any thoughts on using govips for lossy PNG optimization / compression?

support access type for image loader

Hi there,

I am in need of support for specifying the access type on image load. I would implement it on my own and open a pull request.

Should I use an approach compatible to #26 so it gets easier to join the two PRs?

Also, I found that there is already a type Access which seems to be unused ATM.
Where there already plans to support the access type on image loading?

Best Regards

Tilo

fatal error: vips/vips.h: No such file or directory

Hey there guys. I'm trying to make the command go get -u github.com/davidbyttow/govips to work but I keep getting this error:
screen shot 2018-02-04 at 15 32 59

I looks that I have everything installed:
screen shot 2018-02-04 at 15 34 00

But somehow the compilation doesn't work. Any ideas what I can do in order to fix it?

vips_image_new_from_memory

I was hoping for an example on creating a image from a buffer where the buffer is just bytes and not a formatted image object in memory. The current implementation didn't seem to provide access to the vips_image_new_from_memory and vips_image_new_from_memory_copy functions.

Happy to develop the code if that is the suggested route and you take pull requests

thanks,

-rick

Why are some functions unsupported?

I need to use bandjoin and pngsave_buffer in my application, but these functions are marked as "unsupported" in this file.

Why are these functions unsupported? Is there any way I could workaround it and enable them while compiling the bindings?

Can't build

Hi.

Please, can I ask for some help. I've issue to install govips. I'm complete beginner with Go.

Here is my console output

E:\msf\go>go get -u -v github.com/davidbyttow/govips/pkg/vips
github.com/davidbyttow/govips (download)
github.com/davidbyttow/govips/pkg/vips
go build github.com/davidbyttow/govips/pkg/vips: C:\app\Go\pkg\tool\windows_amd64\cgo.exe: exit status 2

Windows 10
gcc (MinGW.org GCC-8.2.0-3) 8.2.0
libvips 8.8
go version go1.12.6 windows/amd64
pkg-config 0.26

Also first error was about missing libpng.pc in libvips, I just renamed libpng16.pc to solve it.

Add support for Linear1

vips_linear is the work horse of libvips. With it alone all manner of manipulations are possible. libvips exposes a simpler vips_linear1 interface that's more inline with the already exposed Composite operation.

I can see that linear1 support exists in the binding as it it used internally. However my attempts to expose it keep running into SIGSEVs locally. I may be missing something.

Export to JPEG/PNG and return it as []byte

Hi,

How can i export to or generate JPEG or PNG from *vips.ImageRef, and then return it as []byte?

At the moment, the only way i know to get a JPEG/PNG image as []byte from a *vips.ImageRef is to first use vips.Jpegsave or vips.Pngsave and then read the generated file as []byte.

Is there any other way?

Apologize, if i'm not explaining my problem correctly.

Thanks!

crosscompile on darwin for linux: undefined symbols

I would be very happy if someone can post a recipe how to build this pkg on OS X for linux?

Running this

GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -v .

on my program which uses the package fails with the message:

/usr/local/Cellar/go/1.10.2/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: ignoring file /var/folders/9k/vjqfzdjs31ng3nljg71nmnxm0000gn/T/go-link-939718562/go.o, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /var/folders/9k/vjqfzdjs31ng3nljg71nmnxm0000gn/T/go-link-939718562/go.o
Undefined symbols for architecture x86_64:
  "__cgo_topofstack", referenced from:
      __cgo_f7895c2c5a3a_C2func_getnameinfo in 000002.o
      __cgo_f7895c2c5a3a_Cfunc_getnameinfo in 000002.o
      __cgo_f7895c2c5a3a_C2func_getaddrinfo in 000004.o
      __cgo_f7895c2c5a3a_Cfunc_gai_strerror in 000004.o
      __cgo_f7895c2c5a3a_Cfunc_getaddrinfo in 000004.o
      __cgo_52a37432605b_Cfunc_add in 000018.o
      __cgo_52a37432605b_Cfunc_composite in 000018.o
      ...
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

There is a similar question on stackoverflow but it has no answer too.

"could not determine kind of name for..."

When I try to install the package I get the following error

$ go get .
# github.com/davidbyttow/govips/pkg/vips
../github.com/davidbyttow/govips/pkg/vips/type.go:405:34: could not determine kind of name for C.VIPS_BLEND_MODE_ADD
../github.com/davidbyttow/govips/pkg/vips/type.go:398:34: could not determine kind of name for C.VIPS_BLEND_MODE_ATOP
../github.com/davidbyttow/govips/pkg/vips/type.go:393:34: could not determine kind of name for C.VIPS_BLEND_MODE_CLEAR
../github.com/davidbyttow/govips/pkg/vips/type.go:413:34: could not determine kind of name for C.VIPS_BLEND_MODE_COLOUR_BURN
../github.com/davidbyttow/govips/pkg/vips/type.go:412:34: could not determine kind of name for C.VIPS_BLEND_MODE_COLOUR_DODGE
../github.com/davidbyttow/govips/pkg/vips/type.go:410:34: could not determine kind of name for C.VIPS_BLEND_MODE_DARKEN
../github.com/davidbyttow/govips/pkg/vips/type.go:399:34: could not determine kind of name for C.VIPS_BLEND_MODE_DEST
../github.com/davidbyttow/govips/pkg/vips/type.go:403:34: could not determine kind of name for C.VIPS_BLEND_MODE_DEST_ATOP
../github.com/davidbyttow/govips/pkg/vips/type.go:401:34: could not determine kind of name for C.VIPS_BLEND_MODE_DEST_IN../github.com/davidbyttow/govips/pkg/vips/type.go:402:34: could not determine kind of name for C.VIPS_BLEND_MODE_DEST_OUT
../github.com/davidbyttow/govips/pkg/vips/type.go:400:34: could not determine kind of name for C.VIPS_BLEND_MODE_DEST_OVER
../github.com/davidbyttow/govips/pkg/vips/type.go:416:34: could not determine kind of name for C.VIPS_BLEND_MODE_DIFFERENCE
../github.com/davidbyttow/govips/pkg/vips/type.go:417:34: could not determine kind of name for C.VIPS_BLEND_MODE_EXCLUSION
../github.com/davidbyttow/govips/pkg/vips/type.go:414:34: could not determine kind of name for C.VIPS_BLEND_MODE_HARD_LIGHT
../github.com/davidbyttow/govips/pkg/vips/type.go:396:34: could not determine kind of name for C.VIPS_BLEND_MODE_IN
../github.com/davidbyttow/govips/pkg/vips/type.go:411:34: could not determine kind of name for C.VIPS_BLEND_MODE_LIGHTEN../github.com/davidbyttow/govips/pkg/vips/type.go:407:34: could not determine kind of name for C.VIPS_BLEND_MODE_MULTIPLY
../github.com/davidbyttow/govips/pkg/vips/type.go:397:34: could not determine kind of name for C.VIPS_BLEND_MODE_OUT
../github.com/davidbyttow/govips/pkg/vips/type.go:395:34: could not determine kind of name for C.VIPS_BLEND_MODE_OVER
../github.com/davidbyttow/govips/pkg/vips/type.go:409:34: could not determine kind of name for C.VIPS_BLEND_MODE_OVERLAY../github.com/davidbyttow/govips/pkg/vips/type.go:406:34: could not determine kind of name for C.VIPS_BLEND_MODE_SATURATE
../github.com/davidbyttow/govips/pkg/vips/type.go:408:34: could not determine kind of name for C.VIPS_BLEND_MODE_SCREEN
../github.com/davidbyttow/govips/pkg/vips/type.go:415:34: could not determine kind of name for C.VIPS_BLEND_MODE_SOFT_LIGHT
../github.com/davidbyttow/govips/pkg/vips/type.go:394:34: could not determine kind of name for C.VIPS_BLEND_MODE_SOURCE
../github.com/davidbyttow/govips/pkg/vips/type.go:404:34: could not determine kind of name for C.VIPS_BLEND_MODE_XOR
../github.com/davidbyttow/govips/pkg/vips/type.go:133:26: could not determine kind of name for C.VIPS_KERNEL_CUBIC
../github.com/davidbyttow/govips/pkg/vips/type.go:134:26: could not determine kind of name for C.VIPS_KERNEL_LANCZOS2
../github.com/davidbyttow/govips/pkg/vips/type.go:135:26: could not determine kind of name for C.VIPS_KERNEL_LANCZOS3
../github.com/davidbyttow/govips/pkg/vips/type.go:132:26: could not determine kind of name for C.VIPS_KERNEL_LINEAR
../github.com/davidbyttow/govips/pkg/vips/type.go:131:26: could not determine kind of name for C.VIPS_KERNEL_NEAREST
../github.com/davidbyttow/govips/pkg/vips/type.go:425:19: could not determine kind of name for C.VIPS_SIZE_BOTH
../github.com/davidbyttow/govips/pkg/vips/type.go:427:19: could not determine kind of name for C.VIPS_SIZE_DOWN
../github.com/davidbyttow/govips/pkg/vips/type.go:428:19: could not determine kind of name for C.VIPS_SIZE_FORCE
../github.com/davidbyttow/govips/pkg/vips/type.go:429:19: could not determine kind of name for C.VIPS_SIZE_LAST
../github.com/davidbyttow/govips/pkg/vips/type.go:426:19: could not determine kind of name for C.VIPS_SIZE_UP

I have the following requirements installed:

$ go version
go version go1.12 linux/amd64
$ vips --version
vips-8.2.2-Sat Jan 30 17:12:08 UTC 2016
$ gcc --version 
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

UPDATE:

I upgraded vips to vips-8.74 and this solved my issue.

Perhaps that should be mentioned in the README that something like vips-2.2 is not enough.

embed example calls resize

Hello, nice project!

This is a very small thing, but I noticed govips/examples/embed/embed.go actually calls Resize() rather than embed.

label error

Hi, I want to complete watermarking with transform.Label, but I got a error. What's wront with it?
`package main

import (
"fmt"
"io/ioutil"

"github.com/davidbyttow/govips/pkg/vips"

)

func main() {
ref, _ := vips.NewImageFromFile("./aaa.PNG")
lp := &vips.LabelParams{Text: "hello world"}

buf, _, err := vips.NewTransform().
	Image(ref).
	Label(lp).
	Apply()
fmt.Println("buf: %v", buf)
fmt.Println("err: %v", err)

ioutil.WriteFile("./xxx.png", buf, 664)

}
`

2018/09/20 02:02:48 libvips was forcibly started automatically, consider calling Startup/Shutdown yourself
2018/09/20 02:02:48 Vips started with concurrency=1 cache_max_files=100 cache_max_mem=104857600 cache_max=500
2018/09/20 02:02:48 Registered image type loader type=jpeg
2018/09/20 02:02:48 Registered image type loader type=magick
2018/09/20 02:02:48 Registered image type loader type=pdf
2018/09/20 02:02:48 Registered image type loader type=png
2018/09/20 02:02:48 Registered image type loader type=svg
2018/09/20 02:02:48 Registered image type loader type=tiff
2018/09/20 02:02:48 Registered image type loader type=webp
2018/09/20 02:02:48 Registered image type loader type=gif
buf: %v []
err: %v VipsOperation: class "text" not found

Stack:
goroutine 1 [running]:
runtime/debug.Stack(0x7faea9dffac0, 0xc00001c210, 0x26)
/usr/local/go/src/runtime/debug/stack.go:24 +0xa7
github.com/davidbyttow/govips/pkg/vips.handleVipsError(0x0, 0x0)
/root/go/src/github.com/davidbyttow/govips/pkg/vips/bridge.go:457 +0x9d
github.com/davidbyttow/govips/pkg/vips.vipsLabel(0x18cb190, 0x4e22d0, 0xb, 0x4e19d9, 0x7, 0x3ff0000000000000, 0x1, 0x3ff0000000000000, 0x1, 0x0, ...)
/root/go/src/github.com/davidbyttow/govips/pkg/vips/bridge.go:446 +0x439
github.com/davidbyttow/govips/pkg/vips.postProcess(0xc00008a140, 0x0, 0x0)
/root/go/src/github.com/davidbyttow/govips/pkg/vips/transform.go:692 +0x152
github.com/davidbyttow/govips/pkg/vips.(*Transform).transform(0xc000097ec8, 0x18cb190, 0x3, 0x0, 0x0, 0xc000097df0)
/root/go/src/github.com/davidbyttow/govips/pkg/vips/transform.go:483 +0x77
github.com/davidbyttow/govips/pkg/vips.(*Transform).Apply(0xc000097ec8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/root/go/src/github.com/davidbyttow/govips/pkg/vips/transform.go:348 +0xe1
main.main()
/root/go/src/test.go:19 +0x1ca

Using `NewImageRef` leads to g_object_unref assertion failed errors.

Hello,

I am trying to do some operations on an image and then after that I'll generate multiple variants from the base image.

So I use NewImageRef() to generate a new ImageRef for each variant I want to have from the base ImageRef.

Now these ImageRef(s) or the base ImageRef are then returned from the calling function based on some logic.

But then I get tons of

(govips:86726): GLib-GObject-CRITICAL **: 04:01:24.535: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(govips:86726): GLib-GObject-CRITICAL **: 04:01:24.537: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(govips:86726): GLib-GObject-CRITICAL **: 04:01:24.540: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

When I pass only return base ImageRef from all my functions, no errors happen, but of course that doesn't achieve what I want. so once I have another ImageRef created from the base ImageRef via NewImageRef and I return it instead of the base ImageRef the error occurs.

panic if using icc_import with libvips w/o ICC support

When using IccImport with a libvips that was build without ICC support a panic occurs.
It would safe a lot of debugging time if ICC related functions were protected by using vips_icc_present().

There are probably many other functions depending on other non-vips libs with the same problem.
However, a meaningful error would be nice.

Memory leak

Hello there,

I'm trying to use this lib as it's recommended by the author of libvips, made up some test in a docker container in order to monitor resource usage and found out memory isn't free after use. I'm not sure what can be done from my end. Reproduction code

func CreateThumbnail(t *Transform, file io.Reader) (io.Reader, error) {
	v := vips.NewTransform().Load(file).ResizeWidth(t.Size)
	_, _, err := v.Apply()
	return file, nil
}

From my tests, as soon as the call to apply is made, the leak is starting and memory is never free. The behavior is everytime the code run through govips, I see ram comsumption growing by 2MB and seem to remain stable around 100MB, this 100MB is never garbage collected.

What can I do? Am I using govips wrong? I noticed the README isn't up to date and couldn't find any documentation out of the go doc.

There's no memory leak when I shortcut govips:

func CreateThumbnail(t *Transform, file io.Reader) (io.Reader, error) {
	return file, nil
}

The full code is here

PS: I'm trying to use govips for this project

Options example

// Option is a type that is passed to internal libvips functions
type Option struct {
	Name   string
	ref    interface{}
	gvalue C.GValue
	closer func(gv *C.GValue)
	output bool
}

Can you provide a example please how I can add a Option to embed in Go to set the white background please

x := 100 - imgRef.Width()/2
y := 100 - imgRef.Height()/2
img, err := vips.Embed(imgRef.Image(), x, y, 200, 200, background)

Reference CLI

$ vips embed
embed an image in a larger image
usage:
   embed in out x y width height
where:
   in           - Input image, input VipsImage
   out          - Output image, output VipsImage
   x            - Left edge of input in output, input gint
			                default: 0
			                min: -1000000000, max: 1000000000
   y            - Top edge of input in output, input gint
			                default: 0
			                min: -1000000000, max: 1000000000
   width        - Image width in pixels, input gint
			                default: 1
			                min: 1, max: 1000000000
   height       - Image height in pixels, input gint
			                default: 1
			                min: 1, max: 1000000000
optional arguments:
   extend       - How to generate the extra pixels, input VipsExtend
			                default: black
			                allowed: black, copy, repeat, mirror, white, background
   background   - Colour for background pixels, input VipsArrayDouble
operation flags: sequential-unbuffered 

Unable to install latest version

Hello,

I'm try to install govips using go get -u github.com/davidbyttow/govips, but I'm getting this error message:

package github.com/davidbyttow/govips: no Go files in /home/karthik/Documents/programs/go/src/github.com/davidbyttow/govips

I'm only able to install it after checking out to a different commit (3c5a4d8).
(due to another issue, I had to run export CGO_CFLAGS_ALLOW='-fopenmp' before installing)

Go version:

~$ go version
go version go1.9.4 linux/amd64
~$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/karthik/Documents/programs/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build385530049=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"

Undefined symbols error when installing on mac

On a macbook pro I get the following error when installing:

$ go get -u github.com/davidbyttow/govips
# github.com/davidbyttow/govips
bridge.c:77:9: warning: implicit declaration of function 'vips_tiffsave_buffer' is invalid in C99 [-Wimplicit-function-declaration]
# github.com/davidbyttow/govips
Undefined symbols for architecture x86_64:
  "_vips_tiffsave_buffer", referenced from:
      _save_tiff_buffer in bridge.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have the required dependencies listed in the README:

$ vips --vips-version
libvips 8.4.2-Mon Oct 31 21:12:19 PDT 2016
$ clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
$ go version
go version go1.9.1 darwin/amd64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.