diff --git a/doc/source/backgroundSubtraction.rst b/doc/source/backgroundSubtraction.rst
index 8f9adc7b89852fe8a46244383cfbb9eb9772fdf8..cab7fa855cc5bb8195aa09ddb4a5c08e39931e62 100644
--- a/doc/source/backgroundSubtraction.rst
+++ b/doc/source/backgroundSubtraction.rst
@@ -17,8 +17,20 @@ by S.Steinberg (1983).
 
     Background Subtraction in action
 
+
+Running Background Subtractor plugin in ImageJ macro.
+-----------------------------------------------------
+
+Very often there is a need to process multiple TIFF files. This process can be
+simplify by using following macro.
+
+.. literalinclude:: resources/macros/runBgSubtracktor.ijm
+    :language: java
+    :linenos:
+
+
 Algorithm Description
-=====================
+---------------------
 
 For better algorithm understanding please refer to `Histogram-based background subtractor forImageJ <http://mosaic.mpi-cbg.de/Downloads/BGS_manual.pdf>`_ document.
 
diff --git a/doc/source/resources/macros/runBgSubtracktor.ijm b/doc/source/resources/macros/runBgSubtracktor.ijm
new file mode 100644
index 0000000000000000000000000000000000000000..da8cd3a367fd390906d2bd9b24f9fd8105925481
--- /dev/null
+++ b/doc/source/resources/macros/runBgSubtracktor.ijm
@@ -0,0 +1,61 @@
+// This macro run Background Subtractor plugin from MosaicSuite
+
+
+// ----- USER PARAMETERS
+
+// Provide input directory with images and output directory 
+// for saving processed images (if same then input images will be changed!)
+inputDirectory = "/home/gonciarz/1/testImages/"
+outputDirectory="/home/gonciarz/1/results/"
+
+// provide lenght of the sliding window, if set to -1 then plugin will auto-detect
+bgSubtractorSlidingWindowLength=-1
+
+// If auto-detection is ON it might happen that plugin is not able to calculate proper length
+// If skipOnFailure is 'false' then popup window will show in such a case (good for interactive operations), 
+// if set to 'true' such a case will be only logged and detected lenght will be set to -1
+//
+// Example of log:
+// 		Macro Options: [length=-1 skipOnFailure ]
+// 		SkipOnFailure = true
+// 		Auto-detected length for image a.tif=201
+// 		Macro Options: [length=-1 skipOnFailure ]
+// 		SkipOnFailure = true
+// 		Auto-detected length for image failingImage.tif=-1
+
+skipOnFailure=false
+
+
+// ----- CODE
+
+// Create output (results) directory, if exist nothing happens
+File.makeDirectory(outputDirectory);
+if (!File.exists(outputDirectory)) {
+    exit("Unable to create directory: " + outputDirectory);
+}
+
+
+// Iterate over all 'tif' images in inputDirectory
+images=getFileList(inputDirectory);
+for (i = 0; i < images.length; i++) {
+
+    // Skip if not 'tif' image
+    if (!endsWith(images[i],".tif")) continue;
+
+    // Open current image
+    fullFileName=inputDirectory + "/" + images[i];
+    print("Processing [" + fullFileName + "]");
+    open(fullFileName);
+    
+
+    // ----- Run background subtractor ------
+    skipCmd = "";
+    if (skipOnFailure) skipCmd = "skipOnFailure";
+    run("Background Subtractor", "length=" + bgSubtractorSlidingWindowLength + " " + skipCmd);	
+
+
+    // Save processed image in output directory and close it
+    save(outputDirectory + "/" + images[i]);
+    close();
+}
+