Index: trunk/ppSkycell/src/ppSkycellLoop.c
===================================================================
--- trunk/ppSkycell/src/ppSkycellLoop.c	(revision 24000)
+++ trunk/ppSkycell/src/ppSkycellLoop.c	(revision 24003)
@@ -201,4 +201,12 @@
         psImageInit(image2, 0);
 
+        psImage *mask1 = NULL, *mask2 = NULL; // Binned masks
+        if (data->masksName) {
+            mask1 = psImageAlloc(numCols1, numRows1, PS_TYPE_IMAGE_MASK);
+            mask2 = psImageAlloc(numCols2, numRows2, PS_TYPE_IMAGE_MASK);
+            psImageInit(mask1, 0xFF);
+            psImageInit(mask2, 0xFF);
+        }
+
         for (int j = 0; j < data->numInputs; j++) {
             if (target->data.S32[j] != i) {
@@ -256,4 +264,8 @@
             psImageOverlaySection(image1, bin1RO->image, xOffset1, yOffset1, "=");
             psImageOverlaySection(image2, bin2RO->image, xOffset2, yOffset2, "=");
+            if (data->masksName) {
+                psImageOverlaySection(mask1, bin1RO->mask, xOffset1, yOffset1, "=");
+                psImageOverlaySection(mask2, bin2RO->mask, xOffset2, yOffset2, "=");
+            }
 
             psFree(bin1RO);
@@ -280,4 +292,6 @@
         ro1->image = image1;
         ro2->image = image2;
+        ro1->mask = mask1;
+        ro2->mask = mask2;
 
         ro1->data_exists = cell1->data_exists = cell1->parent->data_exists = true;
