Popular recipes tagged "power_of_two"http://code.activestate.com/recipes/tags/power_of_two/2010-11-28T16:05:19-08:00ActiveState Code RecipesPower Of Two (Python) 2010-11-28T16:05:19-08:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/577475-power-of-two/ <p style="color: grey"> Python recipe 577475 by <a href="/recipes/users/4174477/">Thomas Lehmann</a> (<a href="/recipes/tags/power_of_two/">power_of_two</a>). </p> <ul> <li>It's a simple algorithm doing nearly the same what you can do when calculating a multiplication on a piece on paper.</li> <li>In python you don't need this. You simply say 2**n and you have it; so see it as prototyping for a final C/C++ program where you are limited by the given datatypes ... as long you don't write a 'BigNumber' class.</li> </ul> Pad images to power-of-two dimensions. (Python) 2008-08-12T18:46:40-07:00Martin Wilsonhttp://code.activestate.com/recipes/users/4166376/http://code.activestate.com/recipes/576416-pad-images-to-power-of-two-dimensions/ <p style="color: grey"> Python recipe 576416 by <a href="/recipes/users/4166376/">Martin Wilson</a> (<a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/imaging/">imaging</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/of/">of</a>, <a href="/recipes/tags/opengl/">opengl</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/power/">power</a>, <a href="/recipes/tags/power_of_two/">power_of_two</a>, <a href="/recipes/tags/python_imaging_library/">python_imaging_library</a>, <a href="/recipes/tags/two/">two</a>). Revision 4. </p> <p>Pads any amount of images each to power-of-two dimensions, useful for OpenGL programming.</p>