InterpolationMode HighQualityBicubic introducing artefacts on edge of resized images

前端 未结 3 1732
心在旅途
心在旅途 2021-01-11 18:13

Using some pretty stock standard C# code to resize an image, and place it on a coloured background

Image imgToResize = Image.FromFile(@\"Dejeuner.jpg\");
Siz         


        
3条回答
  •  Happy的楠姐
    2021-01-11 18:42

    Shamelessly lifting the answer from this question, I found this fixes it:

    using (ImageAttributes wrapMode = new ImageAttributes())
    {
        wrapMode.SetWrapMode(WrapMode.TileFlipXY);
        g.DrawImage(input, rect, 0, 0, input.Width, input.Height, GraphicsUnit.Pixel, wrapMode);
    }
    

提交回复
热议问题