--- a/gdk-pixbuf/pixops/pixops.c
+++ b/gdk-pixbuf/pixops/pixops.c
@@ -2320,6 +2320,10 @@
   if (scale_x == 0 || scale_y == 0)
     return;
 
+  /* Avoid running out of memory scaling down huge images */
+  if (scale_x <= 1.0/SUBSAMPLE || scale_y <= 1.0/SUBSAMPLE)
+    interp_type = PIXOPS_INTERP_NEAREST;
+
   if (interp_type == PIXOPS_INTERP_NEAREST)
     {
       pixops_scale_nearest (dest_buf, render_x0, render_y0, render_x1,
