}
if (frameContentType.equals("image/jpeg"))
format = new JPEGFormat(new Dimension(image.getWidth(null), image.getHeight(null)), Format.NOT_SPECIFIED, Format.byteArray, -1.f, Format.NOT_SPECIFIED, Format.NOT_SPECIFIED);
else if(frameContentType.equals("image/gif"))
format = new GIFFormat(new Dimension(image.getWidth(null), image.getHeight(null)), Format.NOT_SPECIFIED, Format.byteArray, -1.f);
else if(frameContentType.equals("image/png"))
format = new PNGFormat(new Dimension(image.getWidth(null), image.getHeight(null)), Format.NOT_SPECIFIED, Format.byteArray, -1.f);
else
throw new ResourceUnavailableException("Unsupported frame content type: " + frameContentType);
// TODO: this discards first image. save and return first time readFrame is called.