title: How to convert input image to 3D image format
body: <p>I am trying to write image rotation code in C.</p>
  <pre><code> int width, height, channels;
   unsigned char *img = stbi_load(&quot;butterfly.jpg&quot;, &amp;width, &amp;height, &amp;channels, 0);
      
  </code></pre>
  <p>I am reading the image as seen. I want to convert these image data to 3D (row, column, channel) array format to be able to do this line:</p>
  <pre><code>if (Xprime &gt;= 1 &amp;&amp; Yprime &gt;= 1 &amp;&amp; Xprime &lt;= height &amp;&amp; Yprime &lt;= width)
              {
                  pixel = img[Xprime][Yprime];
          }
          returnedOutImage[i][j] = pixel;
      }
  </code></pre>