*/
public static byte[] createSupFrame(SubPicture pic, Bitmap bm, Palette pal) {
// the last palette entry must be transparent
if (pal.getSize() > 255 && pal.getAlpha(255) > 0) {
// quantize image
QuantizeFilter qf = new QuantizeFilter();
Bitmap bmQ = new Bitmap(bm.getWidth(), bm.getHeight());
int[] ct = qf.quantize(bm.toARGB(pal), bmQ.getInternalBuffer(), bm.getWidth(), bm.getHeight(), 255, false, false);
int size = ct.length;
if (size > 255) {
size = 255;
logger.trace("Palette had to be reduced from " + pal.getSize() + " to " + size + " entries.\n");
logger.warn("Quantizer failed.\n");