title: Resizing the image with padding using convert on ubuntu
body: <p>I am using the convert command for resizing the image</p>
  
  <p>There are two versions</p>
  
  <p>Following is the first one, the resultant image maintains the aspect ratio but the image does not necessarily be of size <code>nxn</code></p>
  
  <pre><code> convert temp.jpg -resize nxn temp.jpg
  </code></pre>
  
  <p>The second version </p>
  
  <pre><code> convert temp.jpg -resize nxn! temp.jpg
  </code></pre>
  
  <p>It does not preserve the aspect ratio.</p>
  
  <p>What I want is to preserve the aspect ratio, and fill the rest of the image with a desired RGB value to acheive the size <code>nxn</code></p>
  
  <p>Any ideas?</p>
  
  <p>Thanks</p>