public static mxPngEncodeParam getDefaultEncodeParam(RenderedImage im)
	{
		ColorModel colorModel = im.getColorModel();
		if (colorModel instanceof IndexColorModel)
		{
			return new mxPngEncodeParam.Palette();
		}

		SampleModel sampleModel = im.getSampleModel();
		int numBands = sampleModel.getNumBands();

		if (numBands == 1 || numBands == 2)
		{
			return new mxPngEncodeParam.Gray();
		}
		else
		{
			return new mxPngEncodeParam.RGB();
		}
	}