public static void resizeToPowerOf2(Image image){
        BufferedImage original = ImageToAwt.convert(image, false, true, 0);
        int potWidth = FastMath.nearestPowerOfTwo(image.getWidth());
        int potHeight = FastMath.nearestPowerOfTwo(image.getHeight());
        int potSize = Math.max(potWidth, potHeight);

        BufferedImage scaled = scaleDown(original, potSize, potSize);

        AWTLoader loader = new AWTLoader();
        Image output = loader.load(scaled, false);

        image.setWidth(potSize);
        image.setHeight(potSize);
        image.setDepth(0);
        image.setData(output.getData(0));
        image.setFormat(output.getFormat());
        image.setMipMapSizes(null);
    }
A private constructor to inhibit instantiation of this class.
jme3-desktop/src/main/java/jme3tools/converters/MipMapGenerator.java