Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggest add a type to imcodecs.go #53

Closed
cnjack opened this issue Jan 10, 2018 · 2 comments
Closed

suggest add a type to imcodecs.go #53

cnjack opened this issue Jan 10, 2018 · 2 comments

Comments

@cnjack
Copy link
Contributor

cnjack commented Jan 10, 2018

type FileExt string
const(
    PngFileExt FileExt = ".png"
   JPEGFileExt FileExt = ".jpg"
 ...
)
func IMEncode(fileExt string, img Mat) (buf []byte, err error) {
	cfileExt := C.CString(fileExt)
	defer C.free(unsafe.Pointer(cfileExt))

	b := C.Image_IMEncode(cfileExt, img.Ptr())
	defer C.ByteArray_Release(b)
	return toGoBytes(b), nil
}

I use IMEncode("png", img) evoke a panic

@deadprogram
Copy link
Member

Thanks for the PR to address this, it is now in the dev branch. I will close this issue once the next release goes out.

@cnjack
Copy link
Contributor Author

cnjack commented Jan 10, 2018

get

@cnjack cnjack closed this as completed Jan 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants