   Smooth looking Image downscaling
  Hi Everybody!I am programming on 2D Game which can be started in different resolutions (nice feature, isn''t it Now, if the Game is started in a lower resolution I am downscaling all images (sprites e.t.c.) so they do not have to be scaled at blitting-time. It woks but could look better.I am looking for an algorithm to downscale Images.Bicubic Interpolation do only seem good for upscaling.Thanks for any help! 
  Have a look at the Gamedev articles from the last few months, there has been one on basic image manipulation where some basics on scaling were discussed. ;  It is an excercise in footprint filtering reallly, what you have to decide is how to model the footprint. It is pretty much the same problem as anisotropic texture filtering.A gaussian is good. For instance for 2x2->1 downscaling first convolve the image with [1/4,1/2,1/4] in both directions (a seperable approximation to gaussian convolution) and then drop every second pixel in both directions.A block filter is faster ... and since with non simple ratios for the resizing you cant easily use the convolution->decimation trick that can be important (you would need to project the gaussian footprint for each new pixel seperately, computing the gaussian function for each tap ... even offline that can be slow, although if you want to you can find fast approximations in papers on anisotropic filtering). See for instance : http://mvlsi.kaist.ac.kr/paper/el2003_6_chk.pdf (They use a slight approximation for ratios > 2 in a given direction by using what in essence are RIP-maps ... this isnt really necessary in your case.)Another option is forward image warping or splatting, but the method described in the paper should be good enough. [edited by - PinkyAndThaBrain on February 3, 2004 8:22:36 AM];  First: Thanks for your replys!Shadowdanver: I am unable to find that articel. Are you sure it's still there?PinkyandtheBrain: Thanks for the Links, I'll try the methode suggested in that articel.I found out about a function gluScaleImage, which seems logical for me to use since all my Graphic Engine is based on OpenGL. But is it good for downscaling? Any expririence anybody?Thanks!!!   [edited by - LonelyStar on February 4, 2004 8:00:22 AM];  If I understand you correctly you''re doing this as a preprocess, in which case you may like to look into the Lanczos filter, which Irfanview uses to great effect. Heck, if you are doing it pre-process anyways, you may be able to simply resize your sprites using Irfanview and save yourself some coding.In my experience the Lanczos filter is nice and snappy on a decent system, but you''d definitely never want to try it for realtime processing. At the very worst I''d suggest prescaling all of your sprites downwards (Lanczos isn''t quite as good going upwards, you may prefer Mitchell or a spline filter in that direction) when you load the game data. It won''t take very long, unless you have tens of thousands of sprites, and should produce good results.Note though that if you use things like transparency blitting or a transparency color, filtering your sprites will totally bugger the transparency. You might need to write a custom version of the filter that ignores transparent pixels and does not filter them into other pixels (and vice versa), but optimally I''d suggest using an alpha channel in your sprites to begin with and scaling the alpha channel independently of the color channels. This will effectively produce a basic but useful antialiasing effect for free, which you can''t beat.   PiQ Software  -  Tiny KeyCounter  -  Freon 2/7 Raytracing Accelerator;  OK, I occupied myself with finding out about this "Lanzcos filter".I think I understood some things, but I am not sure if all my conclusions are correct (I am kind of confused).So, I have this lanczos function lanzcos(x). But it only gives me an 1D Kernel for my filter, but I need a 2D Kernel (or not?).From my research about Bicubic Interpolation, I came to the assumption that I should use lanczos2d(x,y)=lanczos(x)*lanczos(y).Is there at least a little bit of correctness in that or is it just garbage?I''ll try to implement that now, whish me luck Thanks!Nathan 