title: Sepia filter CS50 week 4
body: <p>I need to create a filter that converts an colour image into sepia filter with the formulas below on my code. This is a CS50 week 4 problem set.</p>
  
  <p>I am having trouble understanding the errors on I get when I run check50. Please see below my code and the errors that I got. The code makes sense and returns the expected rgb values but I still get two errors on check50.
  <pre>
  :) sepia correctly filters single pixel 
  
  :) sepia correctly filters simple 3x3 image 
  
  :( sepia correctly filters more complex 3x3 image
      expected "25 22 17\n66 5...", not "25 22 17\n66 5..." - ERROR HERE
   
  :( sepia correctly filters 4x4 image
      expected "25 22 17\n66 5...", not "25 22 17\n66 5..." - ERROR HERE
  </p>
  
  <code>// Convert image to sepia
  void sepia(int height, int width, RGBTRIPLE image[height][width])
  {
      float sr = 0;
      float sg = 0;
      float sb = 0;
  
      for (int i = 0; i &lt; height; i++)
      {
          for (int j = 0; j &lt; width; j++)
          {
              sr = (0.393 * image[i][j].rgbtRed + 0.769 * image[i][j].rgbtGreen + 0.189 * image[i][j].rgbtBlue);
              sg = (0.349 * image[i][j].rgbtRed + 0.686 * image[i][j].rgbtGreen + 0.168 * image[i][j].rgbtBlue);
              sb = (0.272 * image[i][j].rgbtRed + 0.534 * image[i][j].rgbtGreen + 0.131 * image[i][j].rgbtBlue);
  
             image[i][j].rgbtRed = round(sr);
             image[i][j].rgbtGreen = round(sg);
             image[i][j].rgbtBlue = round(sb);
          }
      }
  
      for (int i = 0; i &lt; height; i++)
      {
          for (int j = 0; j &lt; width; j++)
          {
             if (image[i][j].rgbtRed &gt; 255)
             {
                 image[i][j].rgbtRed = 255;
  
             }
  
              if (image[i][j].rgbtGreen &gt; 255)
             {
                 image[i][j].rgbtGreen = 255;
  
             }
  
              if (image[i][j].rgbtBlue &gt; 255)
             {
                 image[i][j].rgbtBlue = 255;
  
             }
  
          }
  
      }
  
      return;
  
  }
  </code></pre>