Index: binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs
===================================================================
--- binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs	(revision 244)
+++ binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs	(revision 251)
@@ -1,5 +1,4 @@
 using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Net;
 using System.Threading;
@@ -13,6 +12,6 @@
 		private string staticPart;
 		private bool logMissingFiles;
-		private Dictionary<string, byte[]> icons = new Dictionary<string, byte[]> ();
-		private bool loaded = false;
+        private Dictionary<string, byte[]> icons = new Dictionary<string, byte[]> ();
+        private bool loaded = false;
 
 		public ItemIconHandler (string staticPart, bool logMissingFiles, string moduleName = null) : base(moduleName) {
@@ -30,11 +29,68 @@
 			}
 
-			string fn = req.Url.AbsolutePath.Remove (0, staticPart.Length);
-			fn = fn.Remove (fn.LastIndexOf ('.'));
+            // BEGIN CHANGED BY PSOUZA4
+			string requestFileName = req.Url.AbsolutePath.Remove (0, staticPart.Length);
+			requestFileName = requestFileName.Remove (requestFileName.LastIndexOf ('.'));
 
-			if (icons.ContainsKey (fn)) {
+            string requestColorTintHex = string.Empty;
+            
+            // Chose a split instead of using a querystring variable in the URI, but that may arguably be cleaner
+            if (requestFileName.Contains("@@")) {
+                try {
+                    string[] tempTintingOptions = requestFileName.Split (new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
+                    requestFileName = tempTintingOptions [0];
+                    requestColorTintHex = tempTintingOptions [1].Trim ().ToUpper ();
+                }
+                catch { }
+            }
+
+            if (icons.ContainsKey (requestFileName) && req.Url.AbsolutePath.ToLower ().EndsWith(".png")) {
 				resp.ContentType = MimeType.GetMimeType (".png");
-				resp.ContentLength64 = icons [fn].Length;
-				resp.OutputStream.Write (icons [fn], 0, icons [fn].Length);
+
+                byte[] itemIconData = icons [requestFileName];
+
+                // Note: optionally split this code into a ImageMultiplyBlend method
+                if (!string.IsNullOrEmpty (requestColorTintHex) && (requestColorTintHex != "FFFFFF")) {
+                    try {
+                        System.Drawing.Color colorTint = System.Drawing.ColorTranslator.FromHtml ("#" + requestColorTintHex);
+                        System.Drawing.Bitmap image = (System.Drawing.Bitmap)PetesUtils.GetImageFromBytes (itemIconData);
+
+                        for (var x = 0; x < image.Width; x++) {
+                            for (int y = 0; y < image.Height; y++) {
+                                System.Drawing.Color originalColor = image.GetPixel (x, y);
+                                System.Drawing.Color changedColor = originalColor;
+
+                                // Only change the icon tinting if the alpha channel is fully opaque
+                                if (originalColor.A == 255) {
+                                    // based on http://stackoverflow.com/questions/3837757/multiply-two-images-in-c-sharp-as-multiply-two-layers-in-photoshop
+
+                                    double component_R = (((double)originalColor.R) * ((double)colorTint.R)) / 255.0;
+                                    double component_G = (((double)originalColor.G) * ((double)colorTint.G)) / 255.0;
+                                    double component_B = (((double)originalColor.B) * ((double)colorTint.B)) / 255.0;
+
+                                    if (component_R > 255.0) component_R = 255.0;
+                                    if (component_G > 255.0) component_G = 255.0;
+                                    if (component_B > 255.0) component_B = 255.0;
+
+                                    // multiply blend shouldn't ever calculate below 0, but for completeness let's leave in this logic
+                                    if (component_R < 0.0) component_R = 0.0;
+                                    if (component_G < 0.0) component_G = 0.0;
+                                    if (component_B < 0.0) component_B = 0.0;
+
+                                    changedColor = System.Drawing.Color.FromArgb (originalColor.A, (int)component_R, (int)component_G, (int)component_B);
+                                }                                
+
+                                image.SetPixel (x, y, changedColor);
+                            }
+                        }
+
+                        itemIconData = PetesUtils.SaveImage_ToBytes (image, true);
+                    }
+                    catch { }
+                }
+
+				resp.ContentLength64 = itemIconData.Length;
+				resp.OutputStream.Write (itemIconData, 0, itemIconData.Length);
+                // END CHANGED BY PSOUZA4
 			} else {
 				resp.StatusCode = (int)HttpStatusCode.NotFound;
