Closed superjaja05 closed 5 months ago
Hi @superjaja05,
affine
uses a different system -- you create an interpolation object (you need nearest
) and pass a reference to that.
Unfortunately I never got around to binding this bit of libvips, so it'd need adding. It's not much code, the python equivalent is here:
https://github.com/libvips/pyvips/blob/master/pyvips/vinterpolate.py
it'd just need translating to lua.
I had a very quick go: https://github.com/libvips/lua-vips/commit/5afc0046499f8117180a50c80af27d3ebe202288
But I've not tested it, and I've not touched Lua for a few years, so it's probably all wrong :( I have a deadline this week, but I might try fixing it up and merging it some time early next year.
... so you'd use it like this (if it works):
interpolator = vips.Interpolator.new_from_name("nearest")
sprite_img = sprite_img:rotate(45, {interpolate=interpolator})
You can test the underlying libvips operation from the command-line with eg.:
$ vips rotate k2.jpg x.jpg 45 --interpolate nearest
I had a very quick go: 5afc004
But I've not tested it, and I've not touched Lua for a few years, so it's probably all wrong :( I have a deadline this week, but I might try fixing it up and merging it some time early next year.
@jcupitt I hope you don't mind if I finish your work in the linked commit. It all works, except of this issue, which I discovered while working on it and which also appears with pyvips.
Sure, go ahead! And thank you.
Greetings! I'm trying to rotate an image 45° without any interpolation (Well, GIMP calls it "None" so i suppose its without interpolation) But i can't figure out how to change it, anything i type returns
unsupported gtype for set VipsInterpolate
This is my code:
Any idea how i can change/disable interpolation? Or if its even possible?