/* * Build: * gcc $(pkg-config --cflags gtk+-3.0) sample.c -o sample $(pkg-config --libs gtk+-3.0) */ #include int main (int argc, char *argv[]) { GdkPixbufFormat *format; gint width, height; gtk_init (&argc, &argv); if (argc <= 1) { g_print ("Please pass the absolute path to the image\n"); return 1; } format = gdk_pixbuf_get_file_info (argv[1], &width, &height); if (format) g_print ("Width: %d - Height: %d\n", width, height); else g_print ("Image format not recognized.\n"); return 0; }