Hi,
Am doing the Image Procesing application. Here i am working on Image Cropping. I have done the Image Cropping. But i need that in different Manner.
I need to crop the image, I have to show the cropped part alone like a normal image remaining parts of the image should displayed in dull color in the same picture box.
I have attached my code here.
Loading

FroglegPosted May 18, 2011, 6:07 AM
private void bttnAccept_Click(object sender, EventArgs e)
{
allowCrop = false;
cropBitmap = new Bitmap(cropRectangle.Width, cropRectangle.Height);
Graphics g = Graphics.FromImage(cropBitmap);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;
g.DrawImage(myBmp, 0, 0, cropRectangle, GraphicsUnit.Pixel);
pictureBox1.Left = cropRectangle.Left;
pictureBox1.Top = cropRectangle.Top;
pictureBox1.Image = cropBitmap;
}
Farooque AliPosted May 18, 2011, 2:17 AM
Yes this is ok, I maked some alteration and used your code.
I have to sharpen the Image also. I have code to sharpen a image but it is more than 50 lines of code. Can you please give the simple and shaort code for Image Sharpen.
Thanks
FroglegPosted May 17, 2011, 2:58 PM
try this
private void bttnAccept_Click(object sender, EventArgs e)
{
allowCrop = false;
cropBitmap = new Bitmap(cropRectangle.Width, cropRectangle.Height);
Graphics g = Graphics.FromImage(cropBitmap);
g.DrawImage(myBmp, 0, 0, cropRectangle, GraphicsUnit.Pixel);
pictureBox1.Left = cropRectangle.Left;//<<<<<
pictureBox1.Top = cropRectangle.Top;//<<<<
pictureBox1.Image = cropBitmap;
}
Farooque AliPosted May 17, 2011, 5:59 AM
The Given code is ok. but my requirement is,
If i crop an image, then the cropped image should displayed at the same place where i cropped from orginal image.
Hope you understand
Thanks
FroglegPosted May 17, 2011, 4:38 AM