For example, nk_xsurf_load_image_from_file("lena.png") will display a garbled RGB image and segfault if you try to resize the window.

$ file lena.png
lena.png: PNG image data, 512 x 512, 8-bit/color RGB, non-interlaced
/* --snip-- */
#define NK_IMPLEMENTATION
#define NK_XLIB_IMPLEMENTATION
#define NK_XLIB_INCLUDE_STB_IMAGE
#define NK_XLIB_IMPLEMENT_STB_IMAGE
#include "../../nuklear.h"
#include "nuklear_xlib.h"
/* --snip-- */
struct nk_image img = nk_xsurf_load_image_from_file("lena.png");
while (running)
{
/* --snip-- */
if (nk_begin(ctx, "Image", nk_rect(0, 0, 300, 300), NK_WINDOW_SCALABLE))
{
float win_h = nk_window_get_content_region(ctx).h;
nk_layout_row_dynamic(ctx, win_h, 1);
nk_image(ctx, img);
}
nk_end(ctx);
/* --snip-- */
For example,
nk_xsurf_load_image_from_file("lena.png")will display a garbled RGB image and segfault if you try to resize the window.