0

Sometimes when I resize semi-transparent png's I get weird white pixels on shapes edges. This happens only with images that have shapes (not photos) and when InterpolationMode is set to HighQualityBicubic. Does anyone know why this white pixels show? I get them only on some images.

This is the result I get:

enter image description here

This is the source file:

enter image description here

This is similar file, that does not cause that "white pixel" effect.

enter image description here

Drawing code is very simple:

Bitmap resize = new Bitmap(1024, 177, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(resize))
{
    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
    g.DrawImage(Properties.Resources.Wave01, 0, 0, 1024, 177);
}

Please note, that I use HighQualityBicubic because the code is used for resizing various types of images including photos. Using InterpolationMode.Default seems to solve the problem, but then resizing some image types may produce worse results than HighQualityBicubic.

SiliconMind
  • 2,185
  • 4
  • 25
  • 49
  • See http://stackoverflow.com/questions/4772273/interpolationmode-highqualitybicubic-introducing-artefacts-on-edge-of-resized-im – Brett Wolfington Jan 22 '13 at 20:31
  • @BrettWolfington - I think it's not the same. These are not semi transparent pixels and definitely are not on image edges. Solution for what you are referring is to use `ImageAttributes` with `WrapMode` set to `WrapMode.TileFlipXY`. But this affects only image borders. – SiliconMind Jan 22 '13 at 21:18

0 Answers0