GNOME Bugzilla – Bug 667120
gdk_pixbuf_scale_simple() slow when resizing to 1x1
Last modified: 2013-03-27 18:24:07 UTC
Created attachment 204442 [details] Example image causing this problem I've created the following example to demonstrate the problem: ----- #include <gtk/gtk.h> #include <gdk/gdk.h> int main(int argc,char **argv) { gtk_init(&argc,&argv); GdkPixbuf *img = gdk_pixbuf_new_from_file("dummy.png",NULL); GdkPixbuf *scaled = gdk_pixbuf_scale_simple(img,1,1,GDK_INTERP_BILINEAR); return 0; } ----- Timing this program gives: $ time ./example real 0m0.750s user 0m0.720s sys 0m0.020s When I change either width or height to something else than 1, its much faster: $ time ./example real 0m0.021s user 0m0.012s sys 0m0.004s As it seems, this happens only for 1x1 with all interpolation modes except GDK_INTERP_NEAREST. Additionally, it depends on the image. Therefore I've attached the dummy.png I'm using. Note also that this isn't a problem that does only occur in such silly example programs, because I discovered this problem using gtkmm by reacting to on_size_allocate() of an image with a resize of that image. At the beginning on_size_allocate() is called with 1x1.
*** This bug has been marked as a duplicate of bug 336327 ***