Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to generate mipmaps for 2D textures as an offline step. My priority is for image quality, execution time is not a concern. The images will, naturally, always be halved and will always be powers-of-2.

I've found this fine article on the subject, which was helpful, but I don't have much knowledge on filtering, so I'm not very sure where to start.

I'm looking for algorithms and hopefully some sample implementations that I can base myself on. Also, using a third party library is an option, as long as it is open source and portable C or C++.

Any help is appreciated.

share|improve this question
For offline generation I'm not certain why you have the open-source/portable requirements. Surely you can just generate them on any machine then ship them with your game. Whether or not the generated mips will be portable depends on your chosen format, not your generation tool (provided it supports the format, of course). You may be limiting your options with these requirements. – Le Comte du Merde-fou May 5 '14 at 18:48
Are you looking for code or does a plugin for Photoshop suffice? – LumpN May 5 '14 at 18:53
Yes, I agree with you Jimmy. What I really want to avoid is licensing issues. That's why open source libraries would be best. @LumpN code of any kind that I can use as a reference. I wish to integrate this with a custom tool. – glampert May 5 '14 at 18:56

You might look into ImageMagick. It's open-source and contains code for resampling images using a variety of filters including Lanczos, Kaiser, Gaussian, etc. It can be used as a library linked into your code, and/or as a set of command-line tools you can call from shell scripts and suchlike.

share|improve this answer
up vote 3 down vote accepted

I have settled with the NVidia Texture Tools library. It has a lot of good texture filters plus other things that might be useful in the future, such as GPU accelerated DXT texture compression. The library is Open Source and released under the MIT licence, which is very unrestrictive.

Thanks for all the replies and comments.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.