title: Unity watermark on image after screenshot
body: <p>I am trying to add a watermark on my image, and this is the code I have for taking a screenshot. Can someone teach me how to implement watermark into my image? I want a small logo at the top right hand side of the image.</p>
  
  <p>I am trying to research on maybe if I could implement what I have in the canvas to stay when a screenshot is taken ( real life ). But to no luck. Would really appreciate if someone could help me out here !</p>
  
  <pre><code>public string MakePhoto(bool openIt)
  {          
      int resWidth = Screen.width;
      int resHeight = Screen.height;
  
      Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false); //Create new texture
      RenderTexture rt = new RenderTexture(resWidth, resHeight, 24);        
  
      // hide the info-text, if any
      if (infoText) 
      {
          infoText.text = string.Empty;
      }
      // render background and foreground cameras
      if (backroundCamera &amp;&amp; backroundCamera.enabled) 
      {
          backroundCamera.targetTexture = rt;
          backroundCamera.Render();
          backroundCamera.targetTexture = null;
      }
  
      if (backroundCamera2 &amp;&amp; backroundCamera2.enabled) 
      {
          backroundCamera2.targetTexture = rt;
          backroundCamera2.Render();
          backroundCamera2.targetTexture = null;
      }
  
      if (foreroundCamera &amp;&amp; foreroundCamera.enabled) 
      {
          foreroundCamera.targetTexture = rt;
          foreroundCamera.Render();
          foreroundCamera.targetTexture = null;
      }
  
      // get the screenshot
      RenderTexture prevActiveTex = RenderTexture.active;
      RenderTexture.active = rt;
  
      screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
  
      // clean-up
      RenderTexture.active = prevActiveTex;
      Destroy(rt);
  
      byte[] btScreenShot = screenShot.EncodeToJPG();
      Destroy(screenShot);
  
      #if !UNITY_WSA
      // save the screenshot as jpeg file
      string sDirName = Application.persistentDataPath + "/Screenshots";
      if (!Directory.Exists(sDirName))
          Directory.CreateDirectory (sDirName);
  
      string sFileName = sDirName + "/" + string.Format ("{0:F0}", Time.realtimeSinceStartup * 10f) + ".jpg";
      File.WriteAllBytes(sFileName, btScreenShot);
  
      Debug.Log("Photo saved to: " + sFileName);
      if (infoText) 
      {
          infoText.text = "Saved to: " + sFileName;
      }
  
      // open file
      if(openIt)
      {
          System.Diagnostics.Process.Start(sFileName);
      }
  
      return sFileName;
  </code></pre>
  
  <p>PS: I found this which might be useful?</p>
  
  <pre><code>public Texture2D AddWatermark(Texture2D background, Texture2D watermark)
  {
  
      int startX = 0;
      int startY = background.height - watermark.height;
  
      for (int x = startX; x &lt; background.width; x++)
      {
  
          for (int y = startY; y &lt; background.height; y++)
          {
              Color bgColor = background.GetPixel(x, y);
              Color wmColor = watermark.GetPixel(x - startX, y - startY);
  
              Color final_color = Color.Lerp(bgColor, wmColor, wmColor.a / 1.0f);
  
              background.SetPixel(x, y, final_color);
          }
      }
  
      background.Apply();
      return background;
  }
  </code></pre>