#include <gdk/gdk.h>

void
load (gchar *filename, gint width, gint height)
{
    GdkPixbuf *pix;
    GError *err = NULL;

    if ((pix = gdk_pixbuf_new_from_file (filename, &err)) == NULL) {
        g_printerr ("error loading %s: %s\n", filename, err->message);
        return;
    }
    g_printf ("%s has size %d x %d\n", filename, gdk_pixbuf_get_width (pix), gdk_pixbuf_get_height (pix));
    g_object_unref (pix);

    if ((pix = gdk_pixbuf_new_from_file_at_scale (filename, width, height, TRUE, &err)) == NULL) {
        g_printerr ("error loading %s: %s\n", filename, err->message);
        return;
    }
    g_printf ("%s loaded at size %d x %d, result is %d x %d\n", filename, width, height, gdk_pixbuf_get_width (pix), gdk_pixbuf_get_height (pix));
    g_object_unref (pix);
}

int
main()
{
    g_type_init();
    load ("test32x32.png", 64, 64);
    load ("test32x32.xpm", 64, 64);
    return 0;
}
