-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
I'm using OpenResty and trying to split an image to NN tiles
I'm trying to use vips_region_fetch like pyvips https://github.com/libvips/pyvips/blob/master/pyvips/vregion.py
local image = vips.Image.new_from_file(image_file, {access = "sequential"})
local region = vobject.new(vips_lib.vips_region_new(image.vimage))
local psize = ffi.new('size_t *')
local pointer = vips_lib.vips_region_fetch(region, 0, 0, 100, 100, psize)
if (pointer == ffi.NULL) then
ngx.say('unable to fetch from region')
end
pointer = ffi.gc(pointer, glib_lib.g_free)
-- local image = ffi.buffer(pointer, psize[0])
but this line local image = ffi.buffer(pointer, psize[0]) causes nginx crash
40354#40354: worker process 40357 exited on signal 11 (core dumped)
Could you give me some suggestions how i can get it working ?
Btw, i can use image:crop to split image to tiles. with your watermark example, i can merge the tiles like this
image_out = image_out:composite(
image_parts[i],
"over",
{ x = x * tile_width, y = y * tile_height }
)
i think this way slower than vips_arrayjoin. I already tried to work with vips_arrayjoin but not success.
Could you tell me how to use vips_arrayjoin in lua ?
Metadata
Metadata
Assignees
Labels
No labels