Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crop left side of image

What i need to do is just crop following image

enter image description here

and display only the mail item instead of with that mail picture .

I have used the following code but it just crop the right side not left .

Note: Picture is just an example get it from google image

 Bitmap croppedBitmap = new Bitmap("E:/my234.png");
        try
        {
            croppedBitmap = croppedBitmap.Clone(new Rectangle(0,0,202, 17), System.Drawing.Imaging.PixelFormat.DontCare);
            pictureBox1.Image = croppedBitmap;
        }
        catch(Exception ex)
        { string se = ex.ToString(); }
like image 618
yasmuru Avatar asked Aug 26 '13 13:08

yasmuru


People also ask

How do I crop only part of a picture?

Click the picture. Click Picture Tools > Format, and in the Size group, click the arrow under Crop. From the menu that appears, select Aspect Ratio, then click the ratio that you want. A crop rectangle appears, showing you how the picture will appear when cropped to the selected aspect ratio.

How do I crop to the left in paint?

Right mouse click on the selection and choose Crop. Right mouse click on the image and choose Resize. Click on Pixels. Enter horizontal or vertical size (the other side will self adjust) • Save and name.


1 Answers

Have you read MSDN?

It's clearly stated that:

rect

Type: System.Drawing.Rectangle

Defines the portion of this Bitmap to copy. Coordinates are relative to this Bitmap.

All you need are proper coordinates:

Rectangle(20, 0, 182, 17)

like image 163
Na Na Avatar answered Oct 04 '22 14:10

Na Na