diff --git a/gnome-screenshot/gnome-screenshot.c b/gnome-screenshot/gnome-screenshot.c
index fe12c70..ed26bc4 100644
--- a/gnome-screenshot/gnome-screenshot.c
+++ b/gnome-screenshot/gnome-screenshot.c
@@ -96,6 +96,7 @@ static GdkPixbuf *screenshot = NULL;
 static char *last_save_dir = NULL;
 static char *window_title = NULL;
 static char *temporary_file = NULL;
+static gchar *output_file = NULL;
 static gboolean save_immediately = FALSE;
 
 /* Options */
@@ -851,12 +852,33 @@ finish_prepare_screenshot (char *initial_uri, GdkWindow *window, GdkRectangle *r
 
   play_sound_effect (window);
 
-  dialog = screenshot_dialog_new (screenshot, initial_uri, take_window_shot);
-  g_free (initial_uri);
+  if (output_file != NULL) {
+    GError *error = NULL;
+    if (! gdk_pixbuf_save (screenshot, output_file,
+                "png", &error,
+                "tEXt::Software", "gnome-screenshot",
+                NULL))
+    {
+        if (error && error->message)
+            g_critical (_("Unable to save file: %s"), error->message);
+        else
+#define ERROR_MESSAGE _("Unknown error saving screenshot to disk")
+            g_critical (ERROR_MESSAGE);
+        g_error_free (error);
+        exit (1);
+    }
+    else {
+        gtk_main_quit ();
+    }
+  }
+  else {
+    dialog = screenshot_dialog_new (screenshot, initial_uri, take_window_shot);
+    g_free (initial_uri);
 
-  screenshot_save_start (screenshot, save_done_notification, dialog);
+    screenshot_save_start (screenshot, save_done_notification, dialog);
 
-  run_dialog (dialog);
+    run_dialog (dialog);
+  }
 }
 
 static void
@@ -1291,6 +1313,7 @@ main (int argc, char *argv[])
     { "delay", 'd', 0, G_OPTION_ARG_INT, &delay_arg, N_("Take screenshot after specified delay [in seconds]"), N_("seconds") },
     { "border-effect", 'e', 0, G_OPTION_ARG_STRING, &border_effect_arg, N_("Effect to add to the border (shadow, border or none)"), N_("effect") },
     { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive_arg, N_("Interactively set options"), NULL },
+    { "file", 'f', 0, G_OPTION_ARG_STRING, &output_file, N_("Save screenshot directly to this file"), NULL },
     { NULL },
   };
 
