selecting some image pixel and making a new image from it
<p>i am trying to make a new image by selecting some part of the existing image. i have accessed the image pixels and also got their values. if i want to change them i can. but i want what is to select the part of the image through the image pixel values and make a new image through it. its just like cropping an image. i want is to select the image within the boundary specified. for eg, if the boundary around the image is of any color say black or yellow or any color and also of any shape i want what is to select the image within that boundary by their pixel values and copy them to a new image and in that image only those new pixel values should be used to display the image within that boundary. i have also made the algorithm for this but when i implemented it. it dosen't work correct for me. any one who have done it or had any idea then please direct me to the right path. also any piece of code will be of great advantage.</p>

<hr>

<p>well here is the piece of code from me through this i am able to get the pixel values</p>

<p>while(numberofpixel > 0){</p>

<pre><code> if(pixel-&gt;r== 255 &amp;&amp; pixel-&gt;g==255 &amp;&amp; pixel-&gt;b==255){
          pixel-&gt;r=0;
          pixel-&gt;g=0;
          pixel-&gt;b=0;         
}
</code></pre>

<p>pixel++;
numberofpixel--;
}</p>

<p>through this piece of code i can get the image white color pixel and convert them to black. the pixel is a structure which consist of unsigned char r,g,b. the numberofpixel are the total number of pixel in the image. but i can not get the pixel within some area. if anyone have any idea or suggestion then please share it with me. </p>
