void GLibThumbnailingBenchmark()
{
GError *gerror = NULL;
GdkPixbuf *originalpb, *thumbpixbuff;
gint size;
std::vector<std::string> files;
listdir(&files, "/home/mark/ThumbnailingBenchmarks/2000_Wallpapers-Reanimation");
size = 200;
gtk_set_locale ();
gtk_init (NULL, NULL);
std::stringstream full_path;
std::stringstream thumb_path;
std::string full;
std::string thumb;
CTimeProfiler* tp = new CTimeProfiler();
for ( unsigned int i = 0; i < files.size(); i++ )
{
gerror = NULL;
std::cout << files[i];
full_path.str(std::string());
full_path << "/home/mark/ThumbnailingBenchmarks/2000_Wallpapers-Reanimation/" << files[i];
full = full_path.str();
tp->startTime();
originalpb = gdk_pixbuf_new_from_file(full.c_str(), &gerror);
if (!originalpb)
{
printf("error message: %s\n", gerror->message);
exit(1);
}
printf("\n - %f", tp->endTimeR() /1000000000);
thumb_path.str(std::string());
thumb_path << "/home/mark/ThumbnailingBenchmarks/thumbnails/GDK_INTERP_BILINEAR/" << files[i] << ".png";
//thumb_path << "/home/mark/ThumbnailingBenchmarks/thumbnails/GDK_INTERP_BILINEAR/" << files[i];
thumb = thumb_path.str();
//thumbpixbuff = gdk_pixbuf_scale_simple(originalpb, new_width, new_height, GDK_INTERP_NEAREST);
thumbpixbuff = scale_pixbuf_preserve_aspect_ratio(originalpb, size, GDK_INTERP_BILINEAR);
printf("\n - %f", tp->endTimeR() /1000000000);
//gdk_pixbuf_save (thumbpixbuff, thumb.c_str(), "jpeg", &gerror, "quality", "90", NULL);
gdk_pixbuf_save (thumbpixbuff, thumb.c_str(), "png", &gerror, NULL);
printf("\n - %f", tp->endTimeR() /1000000000);
std::cout << std::endl << " - DONE" << std::endl;
gdk_pixbuf_unref(originalpb);
gdk_pixbuf_unref(thumbpixbuff);
}
}