This topic is a continuation of https://ru.stackoverflow.com/questions/574394/%D0%9A%D0%B0%D0%BA-%D0%BE%D0%B1%D1%80% B7% D0% B0% D1% 82% D1% 8C-% D0% B8% D0% B7% D0% BE% D0% B1% D1% 80% D0% B0% D0% B6% D0% B5% D0% BD % D0% B8% D0% B5-% D0% BF% D0% BE% D0% BB% D0% B8% D0% B3% D0% BE% D0% BD% D0% B0% D0% BB% D1% 8C% D0% BD% D0% BE? Noredirect = 1 # comment757642_574394

There is a tiff file that I want to trim. I tried to keep it in all formats, but when trimming it shrinks into a strip. With any other jpeg file, everything works, with tiff-no. Here is an example of a file for the test https://yadi.sk/i/Iqw3jv2wwQ3EV

public Bitmap CropImage(Image img) { // create a graphic path to hold the shape data GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); var points = new Point[] { new Point(85, 1111), new Point(934, 1111), new Point(934, 952), new Point(1642, 952), new Point(1642, 2000), new Point(85, 2000), new Point(85, 1111) }; GraphicsPath gp = new GraphicsPath(); gp.AddPolygon(points.ToArray()); Bitmap bmp1 = new Bitmap(2220, 2220); using (Graphics G = Graphics.FromImage(bmp1)) { G.Clip = new System.Drawing.Region(gp); G.DrawImage(img, 0, 0); pictureBox.Image = bmp1; return bmp1; } } 
  • one
    Under the link to the yadisk nothing is found. Reload the file. And so, I think, you need to either PixelFormat or Resolution correct one. - Alexander Petrov
  • You first check that your TIFF is loading correctly without cropping. And then it may turn out that it is a multi-page one or something else, and it doesn’t shrivel in a strip because of trimming. And check the resolution of the file, because you load it in your Bitmap without specifying the size, it can be either larger or smaller than necessary. - rdorn

0