The a4j:mediaOutput component allows images, video, sounds, and other binary resources to be displayed as defined by a user on the fly.

The createContent attribute references the method that is used for creating content. The method accepts two parameters:

- The OutputStream parameter is a reference to the stream that is used for output.
- The second parameter is a reference to the value attribute of the component.

The value attribute references data that can be used as input data for the content creator method. The data should be serializable since it is encoded as the URL of the resource.

The mimeType attribute defines the type of output content. It is used to define the corresponding type in the header of an HTTP response.

The cacheable attribute is a flag that defines the caching strategy. If cacheable is set to false, the response will not be cached. If set to true, it will be cached and the serialized value of the value attribute is used as a cache key.

This example reads the existing image and re-indexes the palette using colors you selected below.