![]() Let’s see what happens when we shrink to 50%. This one is a near-perfect match for the MagicScaler implementation of the Catmull-Rom (B=0, C=0.5) Cubic – a nice choice. ResampleScope lets me overlay those together to compare them easily. I can compare the shape of the curve to that of a known configuration from MagicScaler to get a more precise definition. We’ll jump straight into the graphs.įor enlarging, we have a perfectly normal Cubic Filter. Having gotten a taste of the Bilinear interpolator, I think I can guess what we’re going to see with Bicubic. This interpolator is fine for enlarging, but you probably don’t want to use it for shrinking unless speed is more important to you than quality. That’s what happens when the edges of the sample range (also known as the filter support) don’t extend to at least ~.75px in each direction, which is about where it was on the 50% shrink. This interpolator will produce aliased output. Here’s the graph for a resize to 25%Įssentially, this interpolator is devolving toward a Box Filter the more we shrink the image. In a properly implemented scaler, we would expect that the shape of the graph would be the same regardless of the resize direction or ratio. The top is cut off, plus it’s squished in at the bottom. Notice that we no longer have a triangle. This graph is from a resize to 50% of the original size. “This mode is not suitable for shrinking an image below 50 percent of its original size”. The documentation for InterpolationMode has an interesting note for the Bilinear value. An eerily similar graph will appear in my upcoming breakdown of the WIC interpolators as well. I’ll be using the correct PixelOffsetMode.Half from now on. The shape is right, but it’s not centered at 0, so it will shift the image up and left. For example, if I set the GDI+ PixelOffsetMode to None, here’s what the graph looks like: One of the neat things about ResampleScope is that it will also show you when the sample points are calculated incorrectly. You can click the images to embiggen them if you like. These graphs are fairly large, so I’m showing them at half size. Yep, that’s a perfectly normal Triangle Filter, all right. The Bilinear (also commonly known as Linear, Tent, or Triangle) interpolator is another completely standard implementation. The GDI+ implementation is completely standard and its output matches my implementation in MagicScaler pixel-for-pixel. The results will be blocky, but when dealing with enlargements of a blocky source, that may actually be desirable. Also sometimes referred to as a Point Filter, it simply maps each pixel in the destination image to the nearest corresponding pixel in the source image. It’s the fastest and lowest quality interpolator available. There’s not much to say about this one nor I can I show a graph of it like I will with the rest. If he had a donate button on his site, I’d totally click it. They have detailed explanations and sample images to go with most.įor my analysis of the GDI+ implementation, I’ll be using the ResampleScope utility, also by Jason Summers. I’ll be linking to that one a lot as I go through the individual interpolators. And if you want to completely geek out on the various standard interpolation algorithms, you can’t go wrong with ImageMagick’s Resampling Filters page. Once you’ve read that, you may also find his “ What is Bicubic Resampling?” enlightening. If you’re not familiar with image resampling terminology or methods, I’d suggest starting with Jason Summers’ excellent article “ Basics of Image Resampling”. This post assumes you have a basic understanding of image resampling algorithms and want to see what the GDI+ implementation actually does compared to other software. ![]() This is more of a technical analysis of the exact implementations and parameters used and how they compare with the standard definitions of those algorithms. I won’t be doing sample comparisons of the various interpolators’ output because that’s already been done, and I don’t have much to add to that. But if you’re curious as to what that means or what the other values mean, read on. ![]() The short version of this post is that if you want to get the best quality from System.Drawing/GDI+, use InterpolationMode.HighQualityBicubic. In this post I’ll be examining the InterpolationMode values in detail. In my last post, I detailed most of the Graphics class settings/values and some tips for getting the best balance of performance and quality. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |