minthantsin / imagelibrary

Automatically exported from code.google.com/p/imagelibrary
Other
0 stars 0 forks source link

Dark top / left border when using GetThumbnailImage #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When resizing an image using the GetThumbnailImage function, a noticeable top 
and left border is created (1px). The following example shows this:

http://3.bp.blogspot.com/_5H9FP3xjceY/SyadiyzvMBI/AAAAAAAAAAc/EttNRWC3Byo/s320/t
humbnail-fit.jpg

Ps. Great library, very easy to use!

Original issue reported on code.google.com by richardv...@gmail.com on 14 May 2011 at 6:31

GoogleCodeExporter commented 9 years ago
Thank you for the error report, I will look into this problem.

Original comment by fr3dr...@gmail.com on 17 May 2011 at 7:15

GoogleCodeExporter commented 9 years ago
I've digged deeper in this problem and I noticed this problem occurs when using 
InterpolationMode.HighQualityBicubic / High on the graphics object. I found 
this answer on stackoverflow which resolves the issue for me, while maintaining 
the HighQualityBicubic property (which is what you want):

http://stackoverflow.com/questions/1890605/ghost-borders-ringing-when-resizing-i
n-gdi/1891479#1891479

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

Original comment by richardv...@gmail.com on 19 May 2011 at 1:12

GoogleCodeExporter commented 9 years ago
Thank you very much for the solution. It has now been implemented :)

Original comment by fr3dr...@gmail.com on 13 Jun 2011 at 8:40