Index: trunk/ippScripts/scripts/background_warp.pl
===================================================================
--- trunk/ippScripts/scripts/background_warp.pl	(revision 28544)
+++ trunk/ippScripts/scripts/background_warp.pl	(revision 33054)
@@ -38,4 +38,5 @@
 
 my ($warp_bg_id, $skycell_id, $tess_dir, $reduction, $camera, $dbname, $outroot, $threads, $verbose, $no_update, $no_op, $redirect, $save_temps);
+my ($astrometry, $imageName, $maskName, $magicked);
 GetOptions(
     'warp_bg_id|i=s'      => \$warp_bg_id, # Warp identifier
@@ -46,4 +47,8 @@
     'reduction=s'         => \$reduction, # Reduction class
     'outroot=s'           => \$outroot, # Output root name
+    'image-list=s'        => \$imageName, # list of input image files
+    'mask-list=s'         => \$maskName, # list of input mask files
+    'astrometry=s'        => \$astrometry,
+    'magicked=s'          => \$magicked,
     'threads=s'           => \$threads,   # Number of threads to use for pswarp
     'verbose'             => \$verbose,   # Print to stdout
@@ -64,5 +69,20 @@
     and defined $outroot;
 
-my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $warp_bg_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
+if ($imageName) {
+    # we have been invoked in a special mode where the caller tells us all about the inputs
+    # This is used by the postage stamp server to make non-background corrected images without
+    # the existence of a warpBackgroundRun (or chipBackgroundRun)
+    # Make sure all of the inputs were supplied
+    if (!(defined $maskName and defined $astrometry and defined $magicked)) {
+        print STDERR "mask-list, astrometry, and magicked must be supplied if image-list is used\n";
+        if ($warp_bg_id) {
+            my_die( "invalid argument list.", $warp_bg_id, $skycell_id, $PS_EXIT_CONFIG_ERROR );
+        }
+        exit $PS_EXIT_CONFIG_ERROR;
+    }
+}
+
+my $ipprc = PS::IPP::Config->new( $camera ) or 
+my_die( "Unable to set up", $warp_bg_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
 
 my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id) or my_die( "Unable to get log filename", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR );
@@ -97,9 +117,9 @@
 # Get list of filenames
 my $tempOutRoot = "/tmp/background.warp.$warp_bg_id.$skycell_id";
-my ($imageFile, $imageName) = tempfile( "$tempOutRoot.image.list.XXXX",  UNLINK => !$save_temps);
-my ($maskFile, $maskName) = tempfile( "$tempOutRoot.mask.list.XXXX",   UNLINK => !$save_temps);
-my $astrometry;                 # Astrometry filename
-my $magicked;                   # Magicked status
-{
+if (!defined $imageName) {
+    # go find our inputs
+    my ($imageFile, $maskFile);
+    ($imageFile, $imageName) = tempfile( "$tempOutRoot.image.list.XXXX",  UNLINK => !$save_temps);
+    ($maskFile, $maskName) = tempfile( "$tempOutRoot.mask.list.XXXX",   UNLINK => !$save_temps);
     my $command = "$bgtool -warpinputs";
     $command .= " -warp_bg_id $warp_bg_id";
@@ -132,7 +152,7 @@
         $astrometry = $astrom;
     }
-}
-close $imageFile;
-close $maskFile;
+    close $imageFile;
+    close $maskFile;
+}
 
 &my_die("Can't find input astrometry: $astrometry", $warp_bg_id, $skycell_id, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($astrometry);
