-
Notifications
You must be signed in to change notification settings - Fork 52
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
Trimming #6
Comments
@h2non what do you think? |
Actually I don't need this feature in a short-term period (I'm just processing real photos), however I've to say that it could be useful introducing support for that feature, specially for some use cases. I'll think about it... Definitively the Python implementation (and Ruby as well) looks pretty easy. This probably requires a better support for C low-level bindings providing a better interface versatility when calling different libvips functions. BTW, I'm thinking in loud about the idea of creating a new Go package to provide a low-level interface and abstraction layer in pure Go to the most common libvips functions, underlying the complexibility and C types coupling in order to simplify when interacting with libvips, just using a clean Go pure API. Also abstracting and to avoid some boilerplate code when interacting with libvips, such as clean references, catch errors, proper thread-based processing etc... As I said, just thinking in loud. |
I'd like that idea! Will be kind of hard especially because of performance problems. While I checked few days ago I saw several Calling |
Regarding to Performance gains are always valuable if the long-term benefit compensates the implementation, specially for some kind of low-level libraries, but I think premature optimizations could be painful. In the case of this statement, the trouble was just a Go core issue, not a Go developer issue. Go was relatively mature, but in terms of GC and memory handling it should be optimized in more ways in the future, and hopefully this is already happening and Go team know it. Regarding to the As conclusion, we could tend to port the each common image operation to a pure C implementation, and designing a high-level API in Go which is based on the composition of C-level functions. I think your |
Yes! and to be honest I was thinking on (for just resize) to use the |
I thought about that as well, but C++ and Go aren't best friends, specially for data structure like classes. I think too much overhead is required to work conformable with C++ code from Go. I think sharp's code can be easily ported into a pure ANSI C version, and in any case, as alternative idea, we could converge in the same C code base. C++ is only required for V8 bindings, which is completely reasonable taking into account it's a node/io.js package, but I'd prefer do not generalize the language decision imposed by a third-party library. libvips is written in C, and in this case, taking into account benefits and cons, it sounds more reasonable using a same language in order to be as much close as possible close to the native implementation and removing layers between. Never mind, just some thoughts :D |
I'm hoping to move sharp to the new vips8 C++ bindings to simplify the code, as demonstrated by this edge detection example. If you're happy moving to a minimum of libvips v7.42.3 (to include jcupitt/libvips@8fbe8c3) you could offload much of the logic, including shrink-vs-affine, to a single vips_resize call. |
Hi, I just came across this issue. I've been tinkering with an FFI-based libvips binding for Lua: https://github.com/jcupitt/lua-vips It's turned out to be pretty simple. There's a "class" for GValue (300 lines of code), a class for VipsObject (200 lines), a class for VipsOperation (220 lines), and an Image class (about 600 lines). The Image class defines all the operator overloads and has a set of convenience functions (so you can write Anyway, that's all you need to get a nice binding for the whole of libvips. And the binding is generated at runtime, so it'll automatically expand as operators and options get added. Performance seems good, though Lua has a very nice ffi module that lets you cache and reuse scraps of code, I don't know the Go one. It's not quite done yet, there are some problems integrating reference counts and the Lua garbage collector, sigh. |
Support trimming
Rif.: https://github.com/jcupitt/libvips/issues/233#issuecomment-73486391
The text was updated successfully, but these errors were encountered: