I'm having trouble trying to create an image with text. The same command works in the official command line utility. If I remove TextOptions, then the Rust code also works.
Rust demo
use libvips::{ops, VipsApp};
fn main() {
let _app = VipsApp::new("Test Libvips", false).unwrap();
let image = ops::text_with_opts(
"test",
&ops::TextOptions{
font: "Roboto 12".to_string(),
fontfile: "roboto.ttf".to_string(),
..ops::TextOptions::default()
},
).unwrap();
// ops::jpegsave(&image, "test.jpg").unwrap();
}
An example of a working command
vips text test.jpg "test" --fontfile roboto.ttf --font "Roboto 12"
GDB output
Thread 1 "libvips-segfaul" received signal SIGSEGV, Segmentation fault.
0x00007ffff7f7a0e3 in ?? () from /usr/lib/libgobject-2.0.so.0
(gdb) bt
#0 0x00007ffff7f7a0e3 in () at /usr/lib/libgobject-2.0.so.0
#1 0x00007ffff7f61c9c in g_object_get_valist () at /usr/lib/libgobject-2.0.so.0
#2 0x00007ffff7f61fc5 in g_object_get () at /usr/lib/libgobject-2.0.so.0
#3 0x00007ffff7b8bf9f in vips_operation_get_valist_optional (ap=0x7fffffffcdb0, operation=<optimized out>) at ../vips-8.14.2/libvips/iofuncs/operation.c:854
#4 vips_call_required_optional (operation=operation@entry=0x7fffffffcca0, required=required@entry=0x7fffffffccd0, optional=optional@entry=0x7fffffffcdb0)
at ../vips-8.14.2/libvips/iofuncs/operation.c:921
#5 0x00007ffff7b8c214 in vips_call_by_name (operation_name=<optimized out>, option_string=option_string@entry=0x0, required=required@entry=0x7fffffffccd0, optional=0x7fffffffcdb0)
at ../vips-8.14.2/libvips/iofuncs/operation.c:953
#6 0x00007ffff7b8c69d in vips_call_split (operation_name=<optimized out>, optional=<optimized out>) at ../vips-8.14.2/libvips/iofuncs/operation.c:1057
#7 0x00007ffff7bbf52b in vips_text(VipsImage**, char const*, ...) (out=<optimized out>, text=<optimized out>) at ../vips-8.14.2/libvips/create/text.c:731
#8 0x000055555555e0fa in libvips::ops::text_with_opts (text=..., text_options=0x7fffffffd7b0) at src/ops.rs:5745
#9 0x000055555555c6bf in libvips_segfault_demo::main () at src/main.rs:5
First of all, thanks for the library.
I'm having trouble trying to create an image with text. The same command works in the official command line utility. If I remove
TextOptions
, then the Rust code also works.Rust demo
An example of a working command
GDB output
Additional Information