Note that there are some explanatory texts on larger screens.

plurals
  1. POGhost-borders ('ringing') when resizing in GDI+
    primarykey
    data
    text
    <p>What happens (only noticeable on certain images) is I will see a 1 pixel white border that is inset one pixel. It seems to happen in areas that are light but not white (e.g. the sky). It is similar to when something is oversharpened and a ghost border can be seen next to high contrast edges.</p> <p>Here is the repro code that reproduces it perfectly. I'm using all the highest quality settings for scaling.</p> <pre><code>ImageCodecInfo encoder = null; EncoderParameters encoderParams = null; foreach (ImageCodecInfo codec in ImageCodecInfo.GetImageEncoders()) { if (codec.MimeType == "image/jpeg") { encoder = codec; // use highest quality compression settings encoderParams = new EncoderParameters(1); encoderParams.Param[0] = new EncoderParameter(Encoder.Quality, 100L); break; } } using (Bitmap input = (Bitmap)Bitmap.FromFile(inputPath, true)) { // shrink by multiple of 2 Rectangle rect = new Rectangle(0, 0, input.Width/32, input.Height/32); using (Bitmap output = new Bitmap(rect.Width, rect.Height)) { using (Graphics g = Graphics.FromImage(output)) { // use highest quality settings (updated per Mark Ransom's answer) g.CompositingMode = CompositingMode.SourceCopy; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.SmoothingMode = SmoothingMode.HighQuality; g.DrawImage(input, rect); } output.Save(outputPath, encoder, encoderParams); } } </code></pre> <p>Any ideas? I'm completely baffled. I've read through a ton of questions/answers and none of them seem to affect my situation.</p> <hr> <p><strong>Edit</strong>:</p> <p>This is an example <em>before</em> image: <a href="http://img14.imageshack.us/img14/4174/mg1647.jpg" rel="noreferrer">http://img14.imageshack.us/img14/4174/mg1647.jpg</a></p> <p>This is an example <em>after</em> image: <a href="http://img64.imageshack.us/img64/3156/afterringing.jpg" rel="noreferrer">http://img64.imageshack.us/img64/3156/afterringing.jpg</a></p> <p>It is more pronounced with the original files (before the hosting service "optimizes" them), but you can see in the sky a lighter band one-pixel in on the smaller image.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload