I have looked at other questions such as Ghost-borders ('ringing') when resizing in GDI+ to try and fix my problem, but they don't quite address the issue I am having as they are only fixing the problem when this is on the edge of an image.
I have an image that is transparent on one half and opaque on the other:
When I resize this image I get a very faint grey line where the transparent and the opaque join equivalent to red 254, green 254, green 254 and alpha 199.
The code I am using to resize the image is:
public static Bitmap ResizeBitmap(Bitmap sourceBMP, int width, int height)
{
try
{
Bitmap result = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(result))
{
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(sourceBMP, 0, 0, width, height);
}
sourceBMP.Dispose();
sourceBMP = (Bitmap)result.Clone();
result.Dispose();
return sourceBMP;
}
catch (Exception ex)
{
return sourceBMP;
}
}
I have tried changing the compositing mode, and the wrap mode in image attributes (which I realised was no use because my problem isn't on the edge!) to no avail. I would greatly appreciate any help in coming up with a solution to this if possible.