private void chooseFormat(BufferedImage image) {
        switch (image.getType()) {
            case BufferedImage.TYPE_4BYTE_ABGR :
            case BufferedImage.TYPE_INT_ARGB :
                imageComponentFormat = ImageComponent.FORMAT_RGBA;
                textureFormat = Texture.RGBA;
                break;
            case BufferedImage.TYPE_3BYTE_BGR :
            case BufferedImage.TYPE_INT_BGR:
            case BufferedImage.TYPE_INT_RGB:
                imageComponentFormat = ImageComponent.FORMAT_RGB;
                textureFormat = Texture.RGB;
                break;
            case BufferedImage.TYPE_CUSTOM:
                if (is4ByteRGBAOr3ByteRGB(image)) {
                    SampleModel sm = image.getSampleModel();
                    if (sm.getNumBands() == 3) {
                        //System.out.println("ChooseFormat Custom:TYPE_4BYTE_ABGR");
                        imageComponentFormat = ImageComponent.FORMAT_RGB;
                        textureFormat = Texture.RGB;
                    }
                    else {
                        imageComponentFormat = ImageComponent.FORMAT_RGBA;
                        //System.out.println("ChooseFormat Custom:TYPE_3BYTE_BGR");
                        textureFormat = Texture.RGBA;
                    }
                }
                break;
            default :
                // System.err.println("Unoptimized Image Type "+image.getType());
                imageComponentFormat = ImageComponent.FORMAT_RGBA;
                textureFormat = Texture.RGBA;
                break;
        }
    }