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


FroglegRank #1,020 · 1.9K reputationPosted May 17, 2011, 12:38 AM EDT
Farooque AliRank #7,940 · 231 reputationPosted May 17, 2011, 1:59 AM EDT
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
FroglegRank #1,020 · 1.9K reputationPosted May 17, 2011, 10:58 AM EDT
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 AliRank #7,940 · 231 reputationPosted May 17, 2011, 10:17 PM EDT
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
FroglegRank #1,020 · 1.9K reputationPosted May 18, 2011, 2:07 AM EDT
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;
}