Index: /trunk/ippScripts/scripts/camera_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/camera_exp.pl	(revision 19651)
+++ /trunk/ippScripts/scripts/camera_exp.pl	(revision 19652)
@@ -221,5 +221,6 @@
     # Make the jpeg for binning 1
     if ($run_state eq 'new') {
-        my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
+        my $command = "$ppImage -list $list1Name $outroot"; # Command to run
+        $command .= " -recipe PPIMAGE $recipe1";
         $command .= " -dbname $dbname" if defined $dbname;
 
@@ -235,5 +236,6 @@
     # Make the jpeg for binning 2
     if ($run_state eq 'new') {
-        my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
+        my $command = "$ppImage -list $list2Name $outroot"; # Command to run
+        $command .= " -recipe PPIMAGE $recipe2"
         $command .= " -dbname $dbname" if defined $dbname;
 
Index: /trunk/ippScripts/scripts/detrend_norm_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_norm_exp.pl	(revision 19651)
+++ /trunk/ippScripts/scripts/detrend_norm_exp.pl	(revision 19652)
@@ -59,10 +59,6 @@
 # Recipes to use based on reduction class
 $reduction = 'DETREND' unless defined $reduction;
-
-my $recipe1 = $ipprc->reduction($reduction, 'JPEG_BIN1_IMAGE_' . uc($det_type)); # Recipe to use
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe1;
-
-my $recipe2 = $ipprc->reduction($reduction, 'JPEG_BIN2_IMAGE_' . uc($det_type)); # Recipe to use
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe2;
+my $recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_IMAGE');
+&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe;
 
 # values to extract from output metadata and the stats to calculate
@@ -94,5 +90,5 @@
     $command  = "$dettool -normalizedimfile"; # Command to run
     $command .= " -det_id $det_id";
-    $command .= " -iteration $iter"; 
+    $command .= " -iteration $iter";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -140,5 +136,7 @@
 unless ($no_op) {
     # Make the jpeg for binning 1
-    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
+    $command = "$ppImage -list $list1Name $outroot"; # Command to run
+    $command .= " -recipe PPIMAGE PPIMAGE_N";
+    $command .= " -recipe JPEG $recipe";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -147,5 +145,7 @@
 
     # Make the jpeg for binning 2
-    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
+    $command = "$ppImage -list $list2Name $outroot"; # Command to run
+    $command .= " -recipe PPIMAGE PPIMAGE_N";
+    $command .= " -recipe JPEG $recipe";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -188,5 +188,5 @@
         $command .= " -det_id $det_id";
         $command .= " -iteration $iter";
-	$command .= " -path_base $outroot ";
+        $command .= " -path_base $outroot ";
         $command .= " -code $exit_code";
         $command .= " -dbname $dbname" if defined $dbname;
Index: /trunk/ippScripts/scripts/detrend_process_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 19651)
+++ /trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 19652)
@@ -57,5 +57,5 @@
 
 if ($redirect) {
-    my $logDest = $ipprc->filename("LOG.EXP", $outroot, "NONE") 
+    my $logDest = $ipprc->filename("LOG.EXP", $outroot, "NONE")
         or &my_die("Missing entry in file rules", $det_id, $exp_id, $PS_EXIT_CONFIG_ERROR);
     $ipprc->redirect_output($logDest);
@@ -65,9 +65,6 @@
 $reduction = 'DETREND' unless defined $reduction;
 
-my $recipe1 = $ipprc->reduction($reduction, 'JPEG_BIN1_IMAGE_' . uc($det_type)); # Recipe to use
-&my_die("Unrecognised detrend type: $det_type", $det_id, $exp_id, $PS_EXIT_PROG_ERROR) unless defined $recipe1;
-
-my $recipe2 = $ipprc->reduction($reduction, 'JPEG_BIN2_IMAGE_' . uc($det_type)); # Recipe to use
-&my_die("Unrecognised detrend type: $det_type", $det_id, $exp_id, $PS_EXIT_PROG_ERROR) unless defined $recipe2;
+my $recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_IMAGE'); # Recipe to use
+&my_die("Unrecognised detrend type: $det_type", $det_id, $exp_id, $PS_EXIT_PROG_ERROR) unless defined $recipe;
 
 # values to extract from output metadata and the stats to calculate
@@ -144,5 +141,7 @@
 unless ($no_op) {
     # Make the jpeg for binning 1
-    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
+    $command = "$ppImage -list $list1Name $outroot"; # Command to run
+    $command .= " -recipe PPIMAGE PPIMAGE_N";
+    $command .= " -recipe JPEG $recipe";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -155,5 +154,7 @@
 
     # Make the jpeg for binning 2
-    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
+    $command = "$ppImage -list $list2Name $outroot"; # Command to run
+    $command .= " -recipe PPIMAGE PPIMAGE_N";
+    $command .= " -recipe JPEG $recipe";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -200,5 +201,5 @@
         $command .= " -exp_id $exp_id";
         $command .= " -code $exit_code";
-	$command .= " -path_base $outroot";
+        $command .= " -path_base $outroot";
         $command .= " -dbname $dbname" if defined $dbname;
         system ($command);
Index: /trunk/ippScripts/scripts/detrend_process_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 19651)
+++ /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 19652)
@@ -37,5 +37,5 @@
     'dbname|d=s'        => \$dbname, # Database name
     'reduction=s'       => \$reduction, # Reduction class
-    'threads=s'       	=> \$threads,   # Number of threads to use for ppImage
+    'threads=s'         => \$threads,   # Number of threads to use for ppImage
     'verbose'           => \$verbose,   # Print to stdout
     'no-update'         => \$no_update,
@@ -65,5 +65,6 @@
 # Recipes to use as a function of detrend type
 $reduction = "DETREND" unless defined $reduction;
-my $recipe = $ipprc->reduction($reduction, uc($det_type) . '_PROCESS'); # Recipe name to use
+my $ppimage_recipe = $ipprc->reduction($reduction, uc($det_type) . '_PROCESS'); # Recipe name for ppImage
+my $jpeg_recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_IMAGE'); # Recipe name for JPEG
 
 # values to extract from output metadata and the stats to calculate
@@ -104,5 +105,6 @@
 unless ($no_op) {
     my $command = "$ppImage -file $input_uri $outroot";
-    $command .= " -recipe PPIMAGE $recipe";
+    $command .= " -recipe PPIMAGE $ppimage_recipe";
+    $command .= " -recipe JPEG $jpeg_recipe";
     $command .= " -recipe PPSTATS CHIPSTATS";
     $command .= " -stats $outputStats";
@@ -175,5 +177,5 @@
         $command .= " -exp_id $exp_id";
         $command .= " -class_id $class_id";
-	$command .= " -path_base $outroot";
+        $command .= " -path_base $outroot";
         $command .= " -code $exit_code";
         $command .= " -dbname $dbname" if defined $dbname;
Index: /trunk/ippScripts/scripts/detrend_resid_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_resid_exp.pl	(revision 19651)
+++ /trunk/ippScripts/scripts/detrend_resid_exp.pl	(revision 19652)
@@ -82,9 +82,6 @@
 $reduction = 'DETREND' unless defined $reduction;
 
-my $recipe1 = $ipprc->reduction($reduction, 'JPEG_BIN1_RESID_' . uc($det_type)); # Recipe to use
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe1;
-
-my $recipe2 = $ipprc->reduction($reduction, 'JPEG_BIN2_RESID_' . uc($det_type)); # Recipe to use
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe2;
+my $recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_RESID'); # Recipe to use
+&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe;
 
 # Look for programs we need
@@ -129,5 +126,5 @@
     my ($statFile, $statName) = tempfile( "/tmp/$exp_tag.detresid.$det_id.$iter.stats.XXXX", UNLINK => !$save_temps );
     foreach my $line (@$stdout_buf) {
-	print $statFile $line;
+        print $statFile $line;
     }
     close $statFile;
@@ -143,5 +140,5 @@
 
     foreach my $line (@$stdout_buf) {
-	$cmdflags .= " $line";
+        $cmdflags .= " $line";
     }
     print "cmdflags: $cmdflags\n";
@@ -173,5 +170,7 @@
 unless ($no_op) {
     # Make the jpeg for binning 1
-    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
+    $command = "$ppImage -list $list1Name $outroot"; # Command to run
+    $command .= " -recipe PPIMAGE PPIMAGE_N";
+    $comamnd .= " -recipe JPEG $recipe";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -184,5 +183,7 @@
 
     # Make the jpeg for binning 2
-    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
+    $command = "$ppImage -list $list2Name $outroot"; # Command to run
+    $command .= " -recipe PPIMAGE PPIMAGE_N";
+    $command .= " -recipe JPEG $recipe";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -530,5 +531,5 @@
 
 
-sub value_for_flag 
+sub value_for_flag
 {
     my $cmdflags = shift;
@@ -537,5 +538,5 @@
     my $value = 0.0;
     if ($cmdflags =~ m|$flag|) {
-	($value) = $cmdflags =~ m|$flag\s+(\S+)|;
+        ($value) = $cmdflags =~ m|$flag\s+(\S+)|;
     }
     $value;
Index: /trunk/ippScripts/scripts/detrend_resid_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_resid_imfile.pl	(revision 19651)
+++ /trunk/ippScripts/scripts/detrend_resid_imfile.pl	(revision 19652)
@@ -44,5 +44,5 @@
     'dbname|d=s'        => \$dbname, # Database name
     'reduction=s'       => \$reduction, # Reduction class
-    'threads=s'       	=> \$threads,   # Number of threads to use for ppImage
+    'threads=s'         => \$threads,   # Number of threads to use for ppImage
     'verbose'           => \$verbose,   # Print to stdout
     'no-update'         => \$no_update,
@@ -87,13 +87,14 @@
 
 print "raw recipe: $recipe\n";
-$recipe = $ipprc->reduction($reduction, $recipe);
+$ppimage_recipe = $ipprc->reduction($reduction, $recipe);
+$jpeg_recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_RESID';
 print "real recipe: $recipe\n";
 
 # Flags to specify the particular detrend to use
 use constant DETRENDS => {
-    'bias'     	       => '-bias',      # Specify the bias frame
-    'dark'     	       => '-dark',      # Specify the dark frame
+    'bias'             => '-bias',      # Specify the bias frame
+    'dark'             => '-dark',      # Specify the dark frame
     'dark_premask'     => '-dark',      # Specify the dark frame
-    'shutter'  	       => '-shutter',   # Specify the shutter frame
+    'shutter'          => '-shutter',   # Specify the shutter frame
     'flat_premask'     => '-flat',      # Specify the flat frame
     'domeflat_premask' => '-flat',      # Specify the flat frame
@@ -102,11 +103,11 @@
     'domeflat_raw'     => '-flat',      # Specify the flat frame
     'skyflat_raw'      => '-flat',      # Specify the flat frame
-    'flat'     	       => '-flat',      # Specify the flat frame
-    'domeflat' 	       => '-flat',      # Specify the flat frame
-    'skyflat'  	       => '-flat',      # Specify the flat frame
-    'fringe'   	       => '-fringe',    # Specify the fringe frame
-    'mask'     	       => '-mask',      # Specify the mask frame
-    'darkmask' 	       => '-mask',      # Specify the mask frame
-    'flatmask' 	       => '-mask',      # Specify the mask frame
+    'flat'             => '-flat',      # Specify the flat frame
+    'domeflat'         => '-flat',      # Specify the flat frame
+    'skyflat'          => '-flat',      # Specify the flat frame
+    'fringe'           => '-fringe',    # Specify the fringe frame
+    'mask'             => '-mask',      # Specify the mask frame
+    'darkmask'         => '-mask',      # Specify the mask frame
+    'flatmask'         => '-mask',      # Specify the mask frame
 };
 
@@ -146,5 +147,6 @@
 unless ($no_op) {
     my $command = "$ppImage -file $input_uri $outroot";
-    $command .= " -recipe PPIMAGE $recipe";
+    $command .= " -recipe PPIMAGE $ppimage_recipe";
+    $command .= " -recipe JPEG $jpeg_recipe";
     $command .= " -recipe PPSTATS RESIDUAL";
     $command .= " -F PPIMAGE.OUTPUT PPIMAGE.OUTPUT.RESID";
@@ -235,9 +237,9 @@
         $command .= " -det_id $det_id";
         $command .= " -iteration $iter";
-	$command .= " -ref_det_id $ref_det_id";
-	$command .= " -ref_iter $ref_iter";
+        $command .= " -ref_det_id $ref_det_id";
+        $command .= " -ref_iter $ref_iter";
         $command .= " -exp_id $exp_id";
         $command .= " -class_id $class_id";
-	$command .= " -path_base $outroot";
+        $command .= " -path_base $outroot";
         $command .= " -code $exit_code";
         $command .= " -dbname $dbname" if defined $dbname;
